def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } } def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' } apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { compileSdkVersion 28 sourceSets { main.java.srcDirs += 'src/main/kotlin' } lintOptions { disable 'InvalidPackage' } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.tyty.liftmanager" minSdkVersion 21 targetSdkVersion 28 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" ndk { //设置支持的SO库架构 abiFilters 'armeabi-v7a'//, 'arm64-v8a', 'x86', 'x86_64' } manifestPlaceholders = [ PACKAGE_NAME : applicationId, XG_ACCESS_ID : "2100320854", XG_ACCESS_KEY: "A7D99HE19CAX", HW_APPID : "10839500", XIAOMI_APPID : "", XIAOMI_APPKEY: "", XG_ACCESS_SCHEME:"" ] multiDexEnabled true } signingConfigs { config { // keyAlias 'keykey' // keyPassword 'com.tyty.liftmanager' // // storeFile file('../../key.jks') // storeFile file('D:/keykey.jks') // storePassword 'com.tyty.liftmanager' keyAlias 'liftmanager' keyPassword 'zhengmin123456' storeFile file('../../liftmanager.jks') storePassword 'zhengmin123456' } } buildTypes { release { ndk { //这里其实我觉可以直接是用"armeabi-v7a",但国内几个大哥之前使用的都是"armeabi" abiFilters "armeabi" // abiFilters "armeabi-v7a" } // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.config // signingConfig signingConfigs.debug } debug { ndk { //这里要加上,否则debug包会出问题,后面三个为可选,x86建议加上不然部分模拟器回报错 abiFilters "armeabi", "armeabi-v7a","arm64-v8a", "x86" signingConfig signingConfigs.config } } } } flutter { source '../..' } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' }