Hi i'm getting issue while running ./gradlew assembleRelease after upgrading React native version 0.64 to 0.67, and upgraded gradle version 4.2.1 to 7.1.2, please help me to fix this issue.
Task :library:verifyReleaseResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':library:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
> Android resource linking failed
ERROR:/Users/vv/.gradle/caches/transforms-3/8e1dbca81dfad29f4aee913d13f7c843/transformed/core-1.7.0/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.
app/build.gradlew
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
ndkVersion = "21.4.7075529"
kotlinVersion = "1.4.32"
kotlin_version = '1.4.32'
dokka_version = '0.10.1'
androidxCoreVersion = '1.7.0'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath('com.android.tools.build:gradle:7.1.2')
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
}
}
I had a very similar issue. Changing Gradle back to 4.2.1 will solve the issue. I think something you depend on is built with an older compileSdkVersion that doesn't work with newer Gradle versions.
I don't know if this is a proper solution, but I had the same problem and I solved it by adding 'app:' like this:
gradlew app:assembleRelease
Hope this helps :)
Related
I have tried to change compileSdkVersion = 30 and targetSdkVersion = 30 but still no use it is giving the same error again and again also I clean the Gradle but still no use, so if you can help, please help me. This error is been coming for almost 3 to 4 days from today, before that my project was running obviously fine. I also tried cleaning gradel but still no use.
This is the error body I am getting Error body:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> One or more issues found when checking AAR metadata values:
The minCompileSdk (33) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-31).
Dependency: androidx.browser:browser:1.5.0-alpha01.
AAR metadata file: C:\Users\hp\.gradle\caches\transforms-3\a7a45c1d439f263d5595caa518b0e64b\transformed\browser-1.5.0-alpha01\META-INF\com\android\build\gradle\aar-metadata.properties.
* 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 50s
my android/build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
if (System.properties['os.arch'] == "aarch64") {
// For M1 Users we need to use the NDK 24 which added support for aarch64
ndkVersion = "24.0.8215888"
} else {
// Otherwise we default to the side-by-side NDK version from AGP.
ndkVersion = "22.0.7026061"
}
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.0.4")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:4.1.2")
classpath 'com.google.gms:google-services:4.3.13'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }
}
}```
please do help if you can thank you.
Here is what i did to solve it. The project was on RN-0.66.4 (I upgraded it to the recent version RN-0.70.4)
Then in android/build.gradle I updated compileSdkVersion from 31 to 33.
This is my configurations for build.gradle
I hope it helps.
I have made an android library and uploaded to Github. (https://github.com/Shekhar23/TxtLogSdk)
Now I want to add to jitpack.io. But I get an error!
How can I upload to jitpack.io?
Build log : https://jitpack.io/com/github/Shekhar23/TxtLogSdk/2.1/build.log
A problem occurred evaluating project ':app'.
Failed to apply plugin [id 'com.android.internal.version-check']
Minimum supported Gradle version is 6.1.1. Current version is 4.8.1. If using the gradle wrapper, try editing the distributionUrl in /home/jitpack/build/gradle/wrapper/gradle-wrapper.properties to gradle-6.1.1-all.zip
Initially I also had this error with Gradle 4.8.1, which was for sure confusing:
Found gradle
Gradle build script
WARNING: gradle/wrapper/gradle-wrapper.jar does not exist! Needs to be committed.
ERROR: Gradle wrapper not found. Please add. Using default gradle to build.
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Welcome to Gradle 4.8.1!
See build.log for details.
What I actually missed, is including ./gradlew and ./gradle/wrapper/gradle-wrapper.jar into the git repository. Yes! You should upload these files to github!
After that you can use the latest gradle version, which is awesome!
Here is the build log:
Found gradle
Gradle build script
Found gradle version: 6.5.
Using gradle wrapper
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Downloading https://services.gradle.org/distributions/gradle-6.5-all.zip
...
------------------------------------------------------------
Gradle 6.5
See build.log for details.
Actually this information is in the official manual https://jitpack.io/docs/ANDROID/ , but the requirement for uploading the gradle-files is not totally clear described.
Comment in this issue was very helpful: https://github.com/jitpack/jitpack.io/issues/2311
P.S. Plugin com.github.dcendents.android-maven should be included to two build.gradle-files as described in the manual.
Did you update your Gradle files?
You should have something similar like the config below:
settings.gradle
include ':app', ':NAME_OF_LIBRARY'
rootProject.name = "NAME_OF_LIBRARY"
build.gradle (module)
Add the plugin, group and version
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
group = 'com.github.YOURGITHUBNAME'
version = rootProject.ext.versionName
...
build.gradle (project)
Add the github classpath to your dependencies
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
}
}
allprojects {
repositories {
google()
jcenter()
...
}
}
ext {
compileSdkVersion = 29
buildToolsVersion = '29.0.2'
versionName = '1.0.0'
...
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have a react native app and when I try to run it on my android device i get the following error:
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/myname/Desktop/myapp/android/app/build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> java.nio.file.AccessDeniedException: /Users/myname/.android/build-cache.lock
I'm using the following versions:
react native: 0.57.3
Android studio: 3.2.1
java: "1.8.0_191"
distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
macOS: Mojave 10.14.1
I tried to change Gradle versions but it didn't work. This is my app/build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
}
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
google()
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}
1.Upgrade your gradle to :-
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
2.Delete gradle cache files. It can be in path like C:\Users\username.gradle\caches for windows users. For Unix like sys it will be ~.gradle\caches
You need to update to the latest gradle version to solve this issue.
Upgrade gradle build tools version in the project level build.gradle to 4.0.0 or higher
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
...
}
}
Upgrade the gradle version in the YourProject > gradle > wrapper > gradle-wrapper.properties to 6.0.0 or higher.
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
My application works fine with buildtools 22.x.x, but when I upgrade to 23.x.x and I try to compile I get this error:
Error:Execution failed for task ':appName:compileStagingDebugAndroidTestAidl'. > aidl is missing
I tried running the task from the terminal using
./gradlew compileStagingDebug
and I get this
Task 'compileStagingDebug' is ambiguous in root project 'appName'compileStagingDebugAidl', 'compileStagingDebugAndroidTestAidl', 'compileStagingDebugAndroidTestJavaWithJavac', 'compileStagingDebugAndroidTestNdk', 'compileStagingDebugAndroidTestRenderscript', 'compileStagingDebugAndroidTestSources', 'compileStagingDebugJavaWithJavac', 'compileStagingDebugNdk', 'compileStagingDebugRenderscript', 'compileStagingDebugSources', 'compileStagingDebugUnitTestJavaWithJavac', 'compileStagingDebugUnitTestSources'.
None of these candidates make sense to me, I don't use android aidl nor I have any test.
If I try to run any of these candidates I still get the error
> aidl is missing
This is happening only if I use buildTools 23.x.x, otherwise it's fine. My gradle file is this:
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
useLibrary 'org.apache.http.legacy'
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
}
}
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'io.fabric.tools:gradle:1.+'
}
}
I have no idea how to solve this as it doesn't make any sense at all to me.
I searched for similar problem but everyone is solving it by upgrading their gradle plugin to 1.3.0, which isn't working for me.
I actually found the problem.+
Despite having set the gradle plugin to 1.3.0 in my gradle config file, in File -> Project Structure -> Project the Android plugin version was still set to 1.2.3
Apparently this was overriding the settings in my file and was causing the issue.
The gradle build of my Android project is failing because a dependency of my project needs an older version of the android gradle plugin:
Download https://repo1.maven.org/maven2/org/springframework/android/spring-android-core/1.0.1.RELEASE/spring-android-core-1.0.1.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/android/spring-android-rest-template/1.0.1.RELEASE/spring-android-rest-template-1.0.1.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/spring-asm/3.0.7.RELEASE/spring-asm-3.0.7.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/spring-core/3.0.7.RELEASE/spring-core-3.0.7.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/security/spring-security-crypto/3.1.3.RELEASE/spring-security-crypto-3.1.3.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/social/spring-social-core/1.0.2.RELEASE/spring-social-core-1.0.2.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/android/spring-android-auth/1.0.1.RELEASE/spring-android-auth-1.0.1.RELEASE.jar
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.1.1/jackson-annotations-2.1.1.jar
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.1.1/jackson-core-2.1.1.jar
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.1.2/jackson-databind-2.1.2.jar
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':myapp'.
> Could not resolve all dependencies for configuration ':myapp:classpath'.
> Could not find any version that matches com.android.tools.build:gradle:0.7.+.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml
https://maven.fabric.io/public/com/android/tools/build/gradle/maven-metadata.xml
https://maven.fabric.io/public/com/android/tools/build/gradle/
Required by:
phase1:myapp:unspecified > com.jakewharton.hugo:hugo-plugin:1.1.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 20.894 secs
My project uses com.android.tools.build:gradle:1.0.0, but the dependency, com.jakewharton.hugo, is looking for gradle:0.7.+.
Here are my gradle build files.
Top-level build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
allprojects {
repositories {
mavenCentral()
}
}
Subproject build.gradle:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.jakewharton.hugo:hugo-plugin:1.1.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'hugo'
android {
compileSdkVersion 20
buildToolsVersion '21.1.2'
defaultConfig {
minSdkVersion 13
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
}
}
..
..
..
Looking up Hugo on Github, I verified that release 1.1.0 does ask for the version 0.7.+, but the latest code (unreleased) use the new version (1.1.0)
Is there a way to allow Hugo to build with the old version, while building the rest of my project with the new one?
OR
I copied the top level Hugo source directory from Github into my project. How do I tell gradle to find the hugo plugin there?
We experienced the same issue. If you change your repository to mavenCentral() from jcenter(), it should resolve the issue. Its also possible to have both repositories.