Android Gradle build stuck on app:lintVitalDebug - android

app:lintVitalDebug seems to be a subtask of app:minifyDebugWithR8.
I recently upgraded to Android Studio Electric Eel, not sure if it is related. Only happens on release builds, so probably R8 is the culprit. I use Gradle dependency 7.3.1 and Gradle version 7.5 (inside gradle-wrapper.properties).
Edit:
I ran the task separately now: ./gradlew :app:lintVitalDebug --scan
Here is the output:
FAILURE: Build failed with an exception.
* What went wrong:
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:7.4.0.
Required by:
project :
> No matching variant of com.android.tools.build:gradle:7.4.0 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5' but:
- Variant 'apiElements' capability com.android.tools.build:gradle:7.4.0 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
- Variant 'javadocElements' capability com.android.tools.build:gradle:7.4.0 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
- Variant 'runtimeElements' capability com.android.tools.build:gradle:7.4.0 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
- Variant 'sourcesElements' capability com.android.tools.build:gradle:7.4.0 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
> Could not resolve androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0-alpha04.
Required by:
project :
> No matching variant of androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0-alpha04 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5' but:
- Variant 'apiElements' capability androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0-alpha04 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
- Variant 'runtimeElements' capability androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0-alpha04 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
- Variant 'sourcesElements' capability androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0-alpha04 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
> Could not resolve com.android.tools.build:gradle:7.1.0.
Required by:
project : > com.google.android.gms:oss-licenses-plugin:0.10.6
> No matching variant of com.android.tools.build:gradle:7.4.0 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5' but:
- Variant 'apiElements' capability com.android.tools.build:gradle:7.4.0 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
- Other compatible attribute:

Solved by reverting Gradle dependency to 7.3.1 and Gradle version to 7.4 (inside gradle-wrapper.properties).

Related

What went wrong: A problem occurred configuring project ':qr_code_scanner'

FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':qr_code_scanner'.
Could not resolve all artifacts for configuration ':qr_code_scanner:classpath'.
Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10.
Required by:
project :qr_code_scanner
> The consumer was configured to find a runtime of a component compatible with Java 11, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10:
- gradle70JavadocElements
- gradle70RuntimeElements
- gradle70SourcesElements
- javadocElements
- runtimeElementsWithFixedAttribute
- sourcesElements
All of them match the consumer attributes:
- Variant 'gradle70JavadocElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10 declares a runtime of a component, and its dependencies declared externally:
- Unmatched attributes:
- Provides documentation but the consumer didn't ask for it
- Provides javadocs but the consumer didn't ask for it
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about its elements (required them packaged as a jar)
- Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'gradle70RuntimeElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10 declares a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides a library but the consumer didn't ask for it
- Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
- Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'gradle70SourcesElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10 declares a runtime of a component, and its dependencies declared externally:
- Unmatched attributes:
- Provides documentation but the consumer didn't ask for it
- Provides sources but the consumer didn't ask for it
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about its elements (required them packaged as a jar)
- Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'javadocElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10 declares a runtime of a component, and its dependencies declared externally:
- Unmatched attributes:
- Provides documentation but the consumer didn't ask for it
- Provides javadocs but the consumer didn't ask for it
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about its elements (required them packaged as a jar)
- Provides release status but the consumer didn't ask for it
- Variant 'runtimeElementsWithFixedAttribute' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10 declares a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides a library but the consumer didn't ask for it
- Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'sourcesElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10 declares a runtime of a component, and its dependencies declared externally:
- Unmatched attributes:
- Provides documentation but the consumer didn't ask for it
- Provides sources but the consumer didn't ask for it
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about its elements (required them packaged as a jar)
- Provides release status but the consumer didn't ask for it
The following variants were also considered but didn't match the requested attributes:
- Variant 'apiElementsWithFixedAttribute' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10 declares a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
- Variant 'gradle70ApiElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10 declares a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
Failed to notify project evaluation listener.
Could not get unknown property 'android' for project ':qr_code_scanner' of type org.gradle.api.Project.
Could not get unknown property 'android' for project ':qr_code_scanner' of type org.gradle.api.Project.
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 6s
Exception: Gradle task assembleDebug failed with exit code 1

Could not resolve all task dependencies for configuration

./gradlew clean assembleDebug
Could not determine the dependencies of task ':demoApp:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':demoApp:debugCompileClasspath'.
> Could not resolve project :mepAnalytics.
Required by:
project :demoApp > project :VisaInAppCore
> No matching configuration of project :mepAnalytics was found. The consumer was configured to find an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.gradle.internal.dependency.AndroidTypeAttr' with value 'Aar', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
- None of the consumable configurations have attributes.
But I have already configure the project module in settings.gradle
include ':mepAnalytics'
project(':mepAnalytics').projectDir = new File('../mep_analytics_sdk_android/mepAnalytics')
Anyone knows why?

Android Task :app:lint - Runtime JAR file has version older than required for API version

I was trying to build an Android App using React-Native. While adding Facebook Login functionality I ran into a weird issue giving me the below error:
> Task :app:lint
w: Runtime JAR files in the classpath have the version 1.3, which is older than the API version 1.4. Consider using the runtime of version 1.4, or pass '-api-version 1.3' explicitly to restrict the available APIs to the runtime of version 1.3. You can also pass '-language-version 1.3' instead, which will restrict not only the APIs to the specified version, but also the language features
w: C:\Users\your-machine\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-common\1.3.31\20c34a04ea25cb1ef0139598bd67c764562cb170\kotlin-stdlib-common-1.3.31.jar: Runtime JAR file has version 1.3 which is older than required for API version 1.4
w: C:\Users\your-machine\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-jdk7\1.3.31\e652770b6416c6d85934086899ffed3eccd35813\kotlin-stdlib-jdk7-1.3.31.jar: Runtime JAR file has version 1.3 which is older than required for API version 1.4
w: C:\Users\your-machine\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib\1.3.31\11289d20fd95ae219333f3456072be9f081c30cc\kotlin-stdlib-1.3.31.jar: Runtime JAR file has version 1.3 which is older than required for API version 1.4
w: C:\Users\your-machine\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-common\1.3.31\20c34a04ea25cb1ef0139598bd67c764562cb170\kotlin-stdlib-common-1.3.31.jar: Runtime JAR file has version 1.3 which is older than required for API version 1.4
I do understand that this is something to do with my Kotlin configuration, but I have not done any configuration on my own so far. It is all default which comes with React-Native.
Any suggestion what the issue is and how can I fix this?
Check the versions of dependencies mentioned in logs
eg: \kotlin-stdlib-common has added version of 1.3.31 where the latest one is 1.4
Change the dependencies to the latest versions in your build.gradle file or check for there instances in your maven dependency injection files (if used)
and rebuid the project

Android Studio Gradle Build Error: Could not determine the dependencies of task ':app:compileFreeDebugJavaWithJavac'

Then on building or launhcing on my device i get following error:
Could not determine the dependencies of task ':app:compileFreeDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:freeDebugCompileClasspath'.
> Could not resolve project :capacitor-android.
Required by:
project :app
> No matching configuration of project :capacitor-android was found. The consumer was configured to find an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'minApi' with value '____free', attribute 'tier' with value 'free', attribute 'abi' with value 'x86' but:
- None of the consumable configurations have attributes.
It is building my project using grable.
I have tried Build Clean, Build Rebuild and File > Invlaidate Caches and Resatrt as well.
Kindly help.
Installing jetifier solved my error
by executing npm install jetifier
Jetifier tool migrates support-library-dependent libraries to rely on the equivalent AndroidX package

React Native 'run-android' mac issue

I have a react-native project that successfully runs on iOS emulator however, when running react-native run-android I get the following error:
error Failed to install the app. Make sure you have the Android development environment set up
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
I have downloaded Android studio, setup a virtual device, installed necessary JDK.
How can I resolve?
Full error message:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve project :react-native-camera.
Required by:
project :app
> Cannot choose between the following variants of project :react-native-camera:
- generalDebugRuntimeElements
- mlkitDebugRuntimeElements
All of them match the consumer attributes:
- Variant 'generalDebugRuntimeElements' capability VerizonApp:react-native-camera:unspecified:
- Unmatched attributes:
- Found com.android.build.api.attributes.VariantAttr 'generalDebug' but wasn't required.
- Found react-native-camera 'general' but wasn't required.
- Compatible attributes:
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.
- Variant 'mlkitDebugRuntimeElements' capability VerizonApp:react-native-camera:unspecified:
- Unmatched attributes:
- Found com.android.build.api.attributes.VariantAttr 'mlkitDebug' but wasn't required.
- Found react-native-camera 'mlkit' but wasn't required.
- Compatible attributes:
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.
Add this code in android/app/build.gradle
android {
...
defaultConfig {
...
missingDimensionStrategy 'react-native-camera', 'general' <-- insert this line
}
}
I believe you have to set the variant in your android/app/build.gradle.
Read here for more details (Point number 4) : https://react-native-community.github.io/react-native-camera/docs/installation

Categories

Resources