You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.6 KiB
Groovy

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 29
//解决Android或者Flutter 打包 Execution failed for task ':app:compileFlutterBuildRelease'.的问题
// lintOptions {
// checkReleaseBuilds false
// abortOnError false
// disable 'InvalidPackage'
// }
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.flutter.hyzp_ybqx"
minSdkVersion 21
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
ndk {
abiFilters "x86", "arm64-v8a", "armeabi", "armeabi-v7a", "mips" // 不支持"x86_64","x86"模拟器
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
//关闭代码混淆,解决 Flutter 打包后真机运行闪退。
//flutter build apk --release --target-platform android-arm64
//真机运行正常
minifyEnabled false //删除无用代码,只用该行编译报错
//Removing unused resources requires unused code shrinking to be turned on. See http://d.android.com/r/tools/shrink-resources.html for more information.
shrinkResources false //删除无用资源,只用该行编译通过,但真机运行闪退
}
}
//解决Flutter应用打包release版本apk后打不开闪退。经测试无效
// packagingOptions {
// pickFirst 'lib/x86_64/libapp.so'
// pickFirst 'lib/armeabi-v7a/libapp.so'
// pickFirst 'lib/arm64-v8a/libapp.so'
// }
}
flutter {
source '../..'
}