plugins { id 'com.android.application' } android { namespace 'com.example.roughapp2_0bbwiredrpm' compileSdk 34 viewBinding { enabled true } // //add this feature dataBinding { enabled true } defaultConfig { //applicationId "com.example.rougheningapp" minSdk 24 targetSdk 34 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } // android.applicationVariants.all { variant -> // variant.outputs.all { // outputFileName = "Roughening.apk" // } // } // 定义风味维度 flavorDimensions "version" // 定义产品风味 productFlavors { flavor1 { dimension "version" // 第一个应用的包名 applicationId "com.example.roughapp2_0bbwiredrpm" // 应用名称 resValue "string", "app_name", "拉毛" // 版本名后缀,可选 versionNameSuffix "-2.0" } // flavor2 { // dimension "version" // // 第二个应用的包名 // applicationId "com.example.rougheningappTestDebug" // // 应用名称 // resValue "string", "app_name", "BingooRobotDebug" // // 版本名后缀,可选 // versionNameSuffix "-Test" // } } //使用命令行构建特定风味 // ./gradlew assembleFlavor1Debug # 构建flavor1的debug版本 // ./gradlew assembleFlavor2Release # 构建flavor2的release版本 // 为每个风味配置输出文件名 android.applicationVariants.all { variant -> variant.outputs.all { def flavorName = variant.flavorName //outputFileName = "Roughening${flavorName}.apk" outputFileName = "Roughening.apk" } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } buildFeatures{ buildConfig true } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } dependencies { implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'com.google.android.material:material:1.9.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' implementation 'com.github.mik3y:usb-serial-for-android:3.7.0' implementation 'com.google.protobuf:protobuf-java:4.27.2' implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20") implementation 'com.github.nodemedia:nodemediaclient-android:2.9.20' implementation 'io.github.xmaihh:serialport:2.1.1' }