Cordova android build :app:processDebugResources failed - android

I woke up this morning, no code has been committed or pushed and I attempted to run a build but suddenly my build failed to give me the following error:
I tried updating Android Studio but that didn't work.
I looked online to check this android:attr/lStar but I could only find something related to react which I'm not using (my project is an Ionic angular application)
I am really puzzled about this has anyone tried this before?
I am using Cordova and the android version is 9.0.0
Abit more info
This is built using the command cordova build android the command that files is:
/Users/admin/myagent/_work/3/s/platforms/android/gradlew cdvBuildDebug -b /Users/admin/myagent/_work/3/s/platforms/android/build.gradle
so cdvBuildDebug -b

Solution 1
Just open your app/build.gradle file and change this line.
androidx.core:core-ktx:+
replace with
androidx.core:core-ktx:1.6.0
Here is an Example:
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
googlePlayServicesAuthVersion = "16.0.1"
androidXCore = "1.6.0"
}
Solution 2
upgrade the compile SDK to Android 31
If you are using androidx.core:core-ktx:+ then this will find the latest version of androidx.core:core-ktx:+ and the latest one is 1.7.0 and the latest version needs the Android 31 compile SDK. So that You are facing this issue.
Here is Two Possible Solution:
1- use a specific version, use androidx.core:core-ktx:${version} instead of androidx.core:core-ktx:+
2- upgrade the compile SDK to Android 31
for more information you can see this article from here.

Related

NativeScript - Android run error "androidx.fragment:fragment:1.4.1 requires 'compileSdkVersion' to be set to 31 or higher"

I'm trying to start with developing Android apps with NativeScript TS, but while starting a template app (drawer) it shows me an error just after webpack compiles:
Execution failed for task ':app:checkDebugAarMetadata'.
One or more issues found when checking AAR metadata values:
Dependency 'androidx.fragment:fragment:1.4.1' requires 'compileSdkVersion' to be set to 31 or higher.
Compilation target for module ':app' is 'android-29'
Sounds like it needs android sdk to be 31 or higher, means Android 12. I have installed Android 8.1 Oreo SDK, this is the one I have on my phone. I've read that NativeScript supports 2X versions too of the SDK, so why this error appears? I followed the instalation tutorial from the NS docs, tested my instalation with ns doctor android command and worked fine.
Java version: OpenJDK 11.0.3 (it was required by Gradle)
Installed Android SDK versions: 25 & 27
SDK Tools: SDK Build Tools 33-rc2, NDK, CMake, Android Emulator, SDK Platform Tools
Any way to fix it, a config change maybe?
Thanks.
Alright, so after few tries and a video from Youtube I solved this problem by editing app.gradle in %PROJECT%/Android/app.gradle and setting sdk versions to 32. There was already such code commented, so I just removed the comments, like:
// You can add your native dependencies here
dependencies {
// implementation 'androidx.multidex:multidex:2.0.1'
}
android {
compileSdkVersion 32
buildToolsVersion "32.0.0"
// ndkVersion ""
defaultConfig {
minSdkVersion 17
targetSdkVersion 32
// Version Information
versionCode 1
versionName "1.0.0"
generatedDensities = []
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
It solved my problem, after running ns run android it properly installs to my phone, even if I don't have Android 12 (api 32)!

Execution failed for task ':flutter_twitter:verifyReleaseResources'

I'm working on Flutter app. I can run app in the android device successfully but try to make build (.apk) file and got below issues.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':flutter_twitter:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/Users/ipatel/.gradle/caches/transforms-2/files-2.1/8f09fa5c6115de167b21b323f769edd9/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.
/Users/ipatel/.gradle/caches/transforms-2/files-2.1/8f09fa5c6115de167b21b323f769edd9/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.
* 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 5m 2s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 303.8s (!)
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin firebase_messaging...
The plugin firebase_messaging could not be built due to the issue above.
Below are project's stuffs
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.xxxx.eeee"
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
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'
}
> local.properties
sdk.dir=/Users/ipatel/Library/Android/sdk
flutter.sdk=/Users/ipatel/Documents/Amit/FlutterSetup/flutter
flutter.buildMode=release
flutter.versionName=1.0.0
flutter.ver
My app is compatible with AndroidX and also tried with many solution but can't able to fix my issue.
I checked
- https://github.com/roughike/flutter_twitter_login/issues/29
- A failure occurred while executing com.android.build.gradle.internal.tasks
- flutter Error "Android dependency 'androidx.core:core' has different version" using flutter_local_notifications and location packages
and others.
Flutter Doctor Result:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.12.13+hotfix.6, on Mac OS X 10.14.3 18D109, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.41.1)
[✓] Connected device (4 available)
build.gradle
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "com.xxxx.aaaa"
minSdkVersion 21
targetSdkVersion 28
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
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
}
}
}
gradle.properties
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
~PS : Let me know if you want more details from my end.
The issue is some library is not compatible or not using androidx while others are. Thanks to google for transferring all support lib to androidx now many libraries having conflicts like this and I mostly go to debug around which lib has an issue like commenting and uncommenting the lib from pubspec.
Assuming the flutter_twitter plugin was the issue.
As we can check that, that twitter plugin not using AndroidX link so we need to change it our self.
(all these changes needs to be changed in twitter plugin, not flutter project)
I think you can change the gradle.properties to use androidx and also compile version to 28
gradle.properties:
android.useAndroidX=true
android.enableJetifier=true
add this two lines, change gradle classpath
classpath 'com.android.tools.build:gradle:3.5.3'
and compileSdkVersion 28 in flutter_twitter.
I am able to generate release build using that plugin.
Ohh yah you can find your cached version of plugin at /Users/parth.dave/.pub-cache/hosted/pub.dartlang.org/flutter_twitter_login-1.1.0/ something like this where you can update it. or either open android folder in androidstudio and studio will show you two projects app and twitter where you can update this things.
also sometimes it's better to open android project in android studio and update all things from which you might get errors before running flutter projects.
Problem is with Execution failed for task ':flutter_twitter:verifyReleaseResources'.
i found link for this issue
flutter_twitter_login/issue #12
Add this dependency in your pubspec.yaml file and let me know this working or not?
flutter_twitter_login:
git: git://github.com/eudangeld/flutter_twitter_login.git
Goto the android studio external libraries in the left side
--> select the library that cause this issue
--> then goto the android -> build.gradle and update the compileSdkVersion to 28
You need to update the compileSdkVersion of the flutter_twitter module to 28 :
1/ In your flutter project, locate your "android" folder and open it as an android project in Android Studio.
2/ Expand "Gradle Scripts" and wait for it to load.
3/ Locate "build.gradle (Module: flutter_twitter)"
4/ Modify the compileSdkVersion from 27->28.
5/ Save the changes.
My build worked after that.
The answer was here : https://github.com/flutter/flutter/issues/32595
thank you, it worked for me for device_id: ^0.1.3
plugin conflit with cloud_firestore: ^0.13.4+2
In your flutter project, locate your android folder and open it as an android project in Android Studio.
Expand Gradle Scripts and wait for it to load.
Locate build.gradle (Module: device_id)
Modify the compileSdkVersion from 27 -> 28.
Save the changes.
I faced a similar issue and here is how I fixed it by following this link.
In Android Studio (with your project open) right-click the android folder, and click "Flutter"->"Open Android Module in Android Studio". Select "Open in New Window"
In the new window, Wait for Gradle to finish the sync
Expand "Gradle Scripts"
Locate "build.gradle (Module: flutter_twitter)" or which so ever package is throwing the error
Modify the compileSdkVersion from 28->29 (or whatever is defined in your android/app/build.gradle file).
Save the changes and run flutter clean
Build the signed apk.
seems like your firebase_messaging library version does not support AndroidX support. Make sure you have updated version of this library.
dependencies:
firebase_messaging: ^6.0.9
I had the same problem before and it took almost a half day to find a solution.
My project compileSdkVersion was already 28 but in my case app-usage package compileSdkVersion was under 28 and i had to change it manually in
/home/"user"/.pub-cache/hosted/pub.dartlang.org/"package with problem"/android/build.gradle.
and it solved the problem.

Android Studio build fail with minSDK=29

I have Android Studio build problem.
Build fails only when changing the minSdk=29 with follwing error.
( It's OK with minSdk=28 )
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.example.aaa"
minSdkVersion 29 // build fails with 29, it's OK with 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Fail messages on Android Studio build console
- Build: build failed
- Run build :
...
Caused by: com.android.tools.r8.utils.AbortException
- Andriod issues: (1 error)
Dex file with version '38' cannot be used with min sdk level '29'.
If anyone resolved this problem, please share your know-hows.
Thank you.
I came across this recently when updating a project for Android studio 3.5.3 to 3.6.3, however I manually changed gradle-wrapper.properties and the project's build.gradle before even opening the project.
In my case I was able to clean the build, delete the .gradle and .idea folders and rebuild without issue.
Edit: As stated in the comments, it is worthwhile to try a clean-rebuild first, rather than the "Scorched Earth" approach of deleting .gradle and .idea folders. Deleting them will take longer to recover from and blow away all your nice IDE settings!
This is because of latest gradle version :
classpath 'com.android.tools.build:gradle:3.5.3'
in Android 6.0 and lower android versions. In order to fix it you can downgrade the gradle version as follows :
classpath 'com.android.tools.build:gradle:3.5.1'
It will run on all android versions perfectly.

Gradle 2.2.0 execution failed: SymbolForDebug

After upgrading gradle of my project (and library attached to it) from 2.1.3 -> 2.2.0 it doesn't build anymore and it says:
Error:Execution failed for task ':app:transformNative_libsWithStripDebugSymbolForDebug'.
java.lang.NullPointerException (no error message)
Anyone have a clue on why this is?
I found answer here:
https://stackoverflow.com/a/40117446/1088975
The point is to set both targetSdkVersion and compileSdkVersion to 22"
You need to change the following lines in build.gradle file:
android {
// SDK 24 worked for me - make sure you have the latest and update it accordingly.
compileSdkVersion 24
buildToolsVersion "24.0.2"
...
}
Maybe you can update the ndk version.
I update the ndk version from r10 to r13,and finally it worked.
You might want to check if the location of your NDK folder has any white space in it...if it has you can move your ndk folder to the c:\ drive and rebuild
Also, check the gradle versiom of your app and either upgrade or download later version, because some ndk versions do not support later gradle version

How to fix build tools (22.0.0/1) dependency issues

Before last month, I have been using Eclipse for android development. But now I am trying to use android studio because of the google's policy.
I am so tired.
I ran across this error
I don't understand this message. Because I don't use "Build Tools revision 23.0.0 rc" I am using 22.0.0.
compileSdkVersion 22
buildToolsVersion "22.0.0"
But I met that's error continue. So I downloaded and Installed Build Tools 23.0.0 rc2. But I met network error.
Solutions please. I am tired.
it happens because of build tools inconsistency. Firstly make sure 22 is installed then 23rc is not installed.
After that in your Android Studio Open Gradle Scripts >> build.gradle (Module:app). Make sure the installed build tool which is 22.0.1 in me is declared here. After changing the numbers make sure you rebuild/sync/refresh the project. And you are done.
Note: Make sure this is done to all of your projects
I am new to the Android programming. But I now get this error.
On 8/28/2015, I have with the SDK Manager on the Android Studio (1.3.2 Build 141.2178183), while my current project was opened, installed new, previously not installed packages and also I have done other recommended update. Subsequently, I received the error message "Install Build Tool revision 23.0.0. rc2" and "Gradle project sync failed. Basic functionality (e.g... Try Again Open 'Messages' View Show Log in Explorer".
I have tried it without success.
Uninstall/new install Build-Tools in the SDK manager brought no change. There was a "Build Tools revsion 232.0 rc2" also not to be found.
Therefore, I have looked at the Grandle files accurately. The file build.gradle (Module: app) in
C: \ Users \ \ AndroidStudioProjects \ \ app \ build.gradle contained the following entry:
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc3"
I have changed this with an editor:
android {
compileSdkVersion 22
buildToolsVersion "23.0.0"
Then I could call up the project again without errors and also perform a synchronization.
I tried above solution it seemed not to work at first but try looking into all build files. For example if your project has got multiple modules say wearable module or like update its gradle build file too.
It seems to be answered perfectly here:
https://stackoverflow.com/a/28159380/3436166
Just install the required version of Build Tools and the dependency issue will be solved.

Categories

Resources