任务 ':app:processDebugResources' 执行失败。无法执行 aapt Ionic 4 android
Execution failed for task ':app:processDebugResources'. Failed to execute aapt Ionic 4 android
ionic cordova build android --prod
这是错误:
What went wrong:
Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
https://developers.google.com/android/guides/releases
The latest update to Google Play services and Firebase includes the
following changes:
Migration from Android Support Libraries to Jetpack (AndroidX)
Libraries. Libraries will not work unless you make the following
changes in your app:
Upgrade com.android.tools.build:gradle to v3.2.1 or later. Upgrade
compileSdkVersion to 28 or later. Update your app to use Jetpack
(AndroidX); follow the instructions in Migrating to AndroidX. Firebase
Bill of Materials (BoM)
由于上述 android SDK 更改,我现在无法构建 APK。我尝试了很多解决方案。但还没有运气。这里有什么线索吗?
这个我试过了。但它不起作用:
build.gradle
project.ext {
defaultBuildToolsVersion="28.0.0" //String
defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
defaultTargetSdkVersion=28 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=28 //Integer - We ALWAYS compile with the latest by default
}
project.properties
target=android-27
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.squareup.okhttp3:okhttp-urlconnection:3.10.0
cordova.gradle.include.1=cordova-plugin-firebase/stella-build.gradle
cordova.system.library.2=com.google.android.gms:play-services-tagmanager:16.0.8
cordova.system.library.3=com.google.firebase:firebase-core:16.0.8
cordova.system.library.4=com.google.firebase:firebase-messaging:17.5.0
cordova.system.library.5=com.google.firebase:firebase-config:16.4.1
cordova.system.library.6=com.google.firebase:firebase-perf:16.2.4
cordova.system.library.7=com.android.support:support-annotations:28.+
这个也试过了。但是没有运气?即 ionic cordova platform add android@8.0.0
$ ionic cordova platform add android@8.0.0
> cordova.cmd platform add android@8.0.0 --save
Using cordova-fetch for cordova-android@8.0.0
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.tt.la
Name: la
Activity: MainActivity
Android target: android-28
Subproject Path: CordovaLib
Subproject Path: app
Android project created with cordova-android@8.0.0
Subproject Path: CordovaLib
Subproject Path: app
Subproject Path: CordovaLib
Subproject Path: app
Error during processing of action! Attempting to revert...
Uh oh!
ENOENT: no such file or directory, open '\platforms\android\app\src\main\AndroidManifest.xml'
好消息!这就是我解决问题的方式。现在一切正常。
注意:我的问题是 Firebase 插件:https://github.com/arnesson/cordova-plugin-firebase
解法:
1. ionic cordova platform rm android
2. ionic cordova plugin rm cordova-plugin-firebase
3. ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
4. ionic cordova plugin add cordova-plugin-androidx
5. ionic cordova plugin add cordova-plugin-androidx-adapter
6. ionic cordova platform add android
7.ionic cordova build android --prod
参考:Git Issue
ionic cordova build android --prod
这是错误:
What went wrong:
Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
https://developers.google.com/android/guides/releases
The latest update to Google Play services and Firebase includes the following changes:
Migration from Android Support Libraries to Jetpack (AndroidX) Libraries. Libraries will not work unless you make the following changes in your app:
Upgrade com.android.tools.build:gradle to v3.2.1 or later. Upgrade compileSdkVersion to 28 or later. Update your app to use Jetpack (AndroidX); follow the instructions in Migrating to AndroidX. Firebase Bill of Materials (BoM)
由于上述 android SDK 更改,我现在无法构建 APK。我尝试了很多解决方案。但还没有运气。这里有什么线索吗?
这个我试过了。但它不起作用:
build.gradle
project.ext {
defaultBuildToolsVersion="28.0.0" //String
defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
defaultTargetSdkVersion=28 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=28 //Integer - We ALWAYS compile with the latest by default
}
project.properties
target=android-27
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.squareup.okhttp3:okhttp-urlconnection:3.10.0
cordova.gradle.include.1=cordova-plugin-firebase/stella-build.gradle
cordova.system.library.2=com.google.android.gms:play-services-tagmanager:16.0.8
cordova.system.library.3=com.google.firebase:firebase-core:16.0.8
cordova.system.library.4=com.google.firebase:firebase-messaging:17.5.0
cordova.system.library.5=com.google.firebase:firebase-config:16.4.1
cordova.system.library.6=com.google.firebase:firebase-perf:16.2.4
cordova.system.library.7=com.android.support:support-annotations:28.+
这个也试过了。但是没有运气?即 ionic cordova platform add android@8.0.0
$ ionic cordova platform add android@8.0.0
> cordova.cmd platform add android@8.0.0 --save
Using cordova-fetch for cordova-android@8.0.0
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.tt.la
Name: la
Activity: MainActivity
Android target: android-28
Subproject Path: CordovaLib
Subproject Path: app
Android project created with cordova-android@8.0.0
Subproject Path: CordovaLib
Subproject Path: app
Subproject Path: CordovaLib
Subproject Path: app
Error during processing of action! Attempting to revert...
Uh oh!
ENOENT: no such file or directory, open '\platforms\android\app\src\main\AndroidManifest.xml'
好消息!这就是我解决问题的方式。现在一切正常。
注意:我的问题是 Firebase 插件:https://github.com/arnesson/cordova-plugin-firebase
解法:
1. ionic cordova platform rm android
2. ionic cordova plugin rm cordova-plugin-firebase
3. ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
4. ionic cordova plugin add cordova-plugin-androidx
5. ionic cordova plugin add cordova-plugin-androidx-adapter
6. ionic cordova platform add android
7.ionic cordova build android --prod
参考:Git Issue