react-native-background-geolocation
react-native-background-geolocation copied to clipboard
Android build error - Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Your Environment
- Plugin version: "@darron1217/react-native-background-geolocation": "^0.6.6"
- Platform: Android
- OS version: All (Not build)
- Device manufacturer and model: All (Not build)
- Running in Simulator: No
- React Native version: "react-native": "0.63.3"
- Plugin configuration options:
- Link to your project:
Context
android/build.gradle
buildscript {
dependencies {
classpath("com.android.tools.build:gradle:3.5.4")
}
}
android/gradle/wrapper/gradle-wrapper.properties:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Expected Behavior
Build correctly
Actual Behavior
Build crash with error:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Possible Fix
Make compatible with Gradle 7
Steps to Reproduce
- Make ./gradlew assembleRelease on Android
Context
I cant build my project
Debug logs
Build logs with: ./gradlew assembleRelease --warning-mode all
> Task :@darron1217_react-native-background-geolocation-common:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
Property 'allSecondaryInputs' is private and annotated with @Internal. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.3/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.
Property 'logging' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.3/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.
Property 'oldSecondaryInputs' is declared without normalization specified. Properties of cacheable work must declare their normalization via @PathSensitive, @Classpath or @CompileClasspath. Defaulting to PathSensitivity.ABSOLUTE. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.3/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.
Property 'path' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.3/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.
Property 'projectName' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.3/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.
Property 'temporaryDir' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.3/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.
Property 'transform' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.3/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.
Property 'workerExecutor' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.3/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.
This project doesn't support gradle 7.0 currently.
My gradle version is 6.8.1
But i don't use gradle 7.
I use this and don't know why i can't build with that versions
android/build.gradle
buildscript {
dependencies {
classpath("com.android.tools.build:gradle:3.5.4")
}
}
android/gradle/wrapper/gradle-wrapper.properties:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Thanks for answer, i try to build with gradle version 6.8.1.
What version do you use here?
classpath("com.android.tools.build:gradle:3.5.4"
Here's what I'm using.
classpath('com.android.tools.build:gradle:4.0.1')
And you can check your gradle version with gradle -v command
I updated gradle versions to your versions.
In local i can do react-native run-android but i use Azure Pipeline to build app and have next errors since i installed this component (with mauron85 component, project build was ok):
/home/vsts/work/1/s/node_modules/@darron1217/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/BackgroundGeolocationFacade.java:489: error: cannot find symbol
if (ContextCompat.checkSelfPermission(context, perm) != PackageManager.PERMISSION_GRANTED) {
^
symbol: variable ContextCompat
location: class BackgroundGeolocationFacade
/home/vsts/work/1/s/node_modules/@darron1217/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java:144: error: package NotificationCompat does not exist
NotificationCompat.Builder builder = null;
^
/home/vsts/work/1/s/node_modules/@darron1217/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java:147: error: package NotificationCompat does not exist
builder = new NotificationCompat.Builder(getContext(), NotificationHelper.SYNC_CHANNEL_ID);
^
/home/vsts/work/1/s/node_modules/@darron1217/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java:218: error: package NotificationCompat does not exist
NotificationCompat.Builder builder = new NotificationCompat.Builder(getContext(), NotificationHelper.SYNC_CHANNEL_ID);
^
/home/vsts/work/1/s/node_modules/@darron1217/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java:218: error: package NotificationCompat does not exist
NotificationCompat.Builder builder = new NotificationCompat.Builder(getContext(), NotificationHelper.SYNC_CHANNEL_ID);
^
/home/vsts/work/1/s/node_modules/@darron1217/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java:231: error: cannot find symbol
LocalBroadcastManager.getInstance(getContext().getApplicationContext()).sendBroadcast(intent);
^
symbol: variable LocalBroadcastManager
location: class SyncAdapter
/home/vsts/work/1/s/node_modules/@darron1217/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/NotificationHelper.java:55: error: package NotificationCompat does not exist
NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext, NotificationHelper.SERVICE_CHANNEL_ID);
^
/home/vsts/work/1/s/node_modules/@darron1217/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/NotificationHelper.java:55: error: package NotificationCompat does not exist
NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext, NotificationHelper.SERVICE_CHANNEL_ID);
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
36 errors
Any idea about how can i fix it? Thanks!
@luisfuertes You must enable Android X and jetifier to make it compatible.
android/gradle.properties
android.useAndroidX=true
android.enableJetifier=true
and run yarn install or npm install to run jetifier. (If it's not working, run npx jetify manually)
I already had it activated
On local i can do ./gradlew assembleRelease but in Pipeline it fail.
Similar like this issue
Hi @luisfuertes were you able to fix it?
@bennyrock20 no, finally i used this mododule (is not free)
@bennyrock20 I was able to fix this by forking this library and running jetifieron it to update code to androidX, if you can't keep your android/grandle.properties because of other libraries
android.useAndroidX=false
android.enableJetifier=false
use my forked branch in your project.
If the changes I made to this works for other people I might create a PR to this library.