常用的几个按钮,clean/assembly会清空c++的so,compile all会加载gradle的依赖并编译java,如果app需要更新,则需要先在手机上删了app在用绿色按钮Run,Debug自动部署新的java端代码。
build.gradle
plugins { alias(libs.plugins.android.application) } android { namespace 'com.example.a13ble2' compileSdk 35 ndkVersion "21.3.6528147" //compileSdkVersion 30 defaultConfig { applicationId "com.example.a13ble2" minSdk 26 targetSdk 35 //minSdkVersion 24 // targetSdkVersion 30 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { arguments '-DANDROID_PLATFORM=android-30', '-DANDROID_STL=c++_shared', "-DANDROID_TOOLCHAIN=" abiFilters 'arm64-v8a' cppFlags "-std=c++11" } } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } externalNativeBuild { cmake { path "src/main/cpp/CMakeLists.txt" version "3.10.2" } } compileOptions { sourceCompatibility JavaVersion.VERSION_11 targetCompatibility JavaVersion.VERSION_11 } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation libs.appcompat implementation libs.material implementation libs.activity implementation libs.constraintlayout testImplementation libs.junit androidTestImplementation libs.ext.junit androidTestImplementation libs.espresso.core // 核心库(必需) implementation 'com.squareup.okhttp3:okhttp:4.12.0' implementation 'com.fasterxml.jackson.core:jackson-core:2.13.0' implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.0' implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.0' implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.0' }
#Tue Dec 31 18:36:21 CST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists