Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failed with error 'Could not determine the dependencies of task ':react-native-imei:bundleLibCompileToJarDebug'.' #25

Open
waleedbhatti opened this issue Jun 27, 2023 · 3 comments

Comments

@waleedbhatti
Copy link

I have followed the doc to extract device imei. Tried every approach I found on stack overflow but it is still giving me this when i uninstall this library my project builds succesfully. Below is the full log.

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ':react-native-imei:bundleLibCompileToJarDebug'.

Could not create task ':react-native-imei:compileDebugJavaWithJavac'.
In order to compile Java 9+ source, please set compileSdkVersion to 30 or above

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --debug option to get more log output.
Run with --scan to get full insights.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/8.0.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1m 51s

Here is my build.gradle:

buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33

    // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
    ndkVersion = "23.1.7779620"
}
repositories {
    google()
    mavenCentral()
}
dependencies {
    classpath("com.android.tools.build:gradle")
    classpath("com.facebook.react:react-native-gradle-plugin")
}

}

Let me know if anything else is needed.

@curtisy1
Copy link

You will have to patch the library if you want to use it with newer React Native versions. The reason is that RN now requires Java 11, which this plugin's compileSdkVersion (28) does not support.

To fix this, you can add a simple patch and get your root project's version instead

diff --git a/android/build.gradle b/android/build.gradle
index fbf1db98c3cd562cc7c0e601688099d0361c768a..77fec36e5622fb8649d82e4058675cdf401bad9b 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -17,7 +17,7 @@ repositories {
 apply plugin: 'com.android.library'
 
 android {
-    compileSdkVersion 28
+    compileSdkVersion rootProject.ext.has('compileSdkVersion') ? rootProject.ext.get('compileSdkVersion') : 30
 
     defaultConfig {
         minSdkVersion 16

That being said, this library probably only works on devices < Android 9, so if you can, you should use a different unique ID.

@Parmar-Bansi
Copy link

Parmar-Bansi commented Jan 25, 2024

any other solution..??
still same issue

In order to compile Java 9+ source, please set compileSdkVersion to 30 or above

@curtisy1
Copy link

What compileSdkVersion did you set in your app's build gradle (not the patch but your actual app)? It needs to be > 30 or this will fail because it simply applies the version of your project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants