1、首先报minsdk 版本过低 我这边使用的是16 改为了19
build.gradle 中改配置 minSdkVersion
代码
def flutterPluginVersion = 'managed'
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.example.bl_flutter_module.host"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
profile {
initWith debug
}
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
}
}
}
buildDir = new File(rootProject.projectDir, "../build/host")
dependencies {
implementation project(':flutter')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "com.android.support:multidex:1.0.3"
}
图片
image.png
2、接着 就报 错误
/Users/apple/MyFlutterPod/bl_flutter_module/.android/app/src/main/AndroidManifest.xml:12:9-42 Error:
Attribute application@label value=(bl_flutter_module) from AndroidManifest.xml:12:9-42
is also present at [com.wuhenzhizao:titlebar:1.2.0] AndroidManifest.xml:13:9-41 value=(@string/app_name).
Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:11:5-38:19 to override.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : Attribute application@label value=(bl_flutter_module) from AndroidManifest.xml:12:9-42
is also present at [com.wuhenzhizao:titlebar:1.2.0] AndroidManifest.xml:13:9-41 value=(@string/app_name).
Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:11:5-38:19 to override.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 24s
Exception: Gradle task assembleDebug failed with exit code 1
按照提示:
再AndroidMainifest.xml文件中添加代码
标签manifest 中加入 xmlns:tools="http://schemas.android.com/tools"
标签application中加入 tools:replace="android:label"
这样子我的项目可以运行了
网友评论