Android Studio gives a warning when compiling project.
See original GitHub issueAPI ‘variant.getJavaCompile()’ is obsolete and has been replaced with ‘variant.getJavaCompileProvider()’. It will be removed at the end of 2019. For more information, see https://d.android.com/r/tools/task-configuration-avoidance. To determine what is calling variant.getJavaCompile(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
REASON: Called from: /home/amol/Desktop/Accountant/node_modules/react-native-reanimated/android/build.gradle:87
line 87 is in android.libraryVariants.all
;
Here is the gradle file
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
apply plugin: 'com.android.library'
apply plugin: 'maven'
android {
compileSdkVersion safeExtGet('compileSdkVersion', 25)
buildToolsVersion safeExtGet('buildToolsVersion', '25.0.2')
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 22)
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
}
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
// Matches the RN Hello World template
// https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/local-cli/templates/HelloWorld/android/build.gradle#L21
url "$projectDir/../node_modules/react-native/android"
}
mavenCentral()
}
dependencies {
implementation 'com.facebook.react:react-native:+'
}
def configureReactNativePom(def pom) {
def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)
pom.project {
name packageJson.title
artifactId packageJson.name
version = packageJson.version
group = "com.swmansion.reanimated"
description packageJson.description
url packageJson.repository.baseUrl
licenses {
license {
name packageJson.license
url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
distribution 'repo'
}
}
developers {
developer {
id packageJson.author.username
name packageJson.author.name
}
}
}
}
afterEvaluate { project ->
task androidJavadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += files(android.bootClasspath)
classpath += files(project.getConfigurations().getByName('compile').asList())
include '**/*.java'
}
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
classifier = 'javadoc'
from androidJavadoc.destinationDir
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
include '**/*.java'
}
android.libraryVariants.all { variant ->
def name = variant.name.capitalize()
// This is line 87 `variant.javaCompile` something needs to change here.
task "jar${name}"(type: Jar, dependsOn: variant.javaCompile) {
from variant.javaCompile.destinationDir
}
}
artifacts {
archives androidSourcesJar
archives androidJavadocJar
}
task installArchives(type: Upload) {
configuration = configurations.archives
repositories.mavenDeployer {
// Deploy to react-native-event-bridge/maven, ready to publish to npm
repository url: "file://${projectDir}/../android/maven"
configureReactNativePom pom
}
}
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:12
- Comments:20 (3 by maintainers)
Top Results From Across the Web
How to solve Android Studio warning Error? - Stack Overflow
It is giving you warning if you are using it please replace it with 'implementation' . So if you are not using 'compile'...
Read more >Improve your code with lint checks - Android Developers
The lint tool checks your Android project source files for potential bugs and optimization improvements for correctness, security, performance, usability, ...
Read more >Suppress compiler warnings - Visual Studio - Microsoft Learn
Right-click on the project node, and choose Properties on the context menu. Or, select the project node and press Alt+Enter. Choose Build, and ......
Read more >Android Studio:How to find errors in code after compile
When I compile my project, I get the output: --------------------------- Information:Compilation completed with 2 errors and 0 warnings in 6 ...
Read more >How to fix "Trust Gradle Project?" warning in Android Studio.
Explained how to avoid the warning "Trust Gradle Project ?" in Android Studio and how to configure android projects directory to the trusted ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello I have same error, with gradle-6-8-all and react-native-reanimated@1.13.2, I just now do eject my project from expo, I have react-native@0.63.4, I launch successfully on iOS but i can’t do it on Android
RESPONSE
react-native -v
package.json
Error Stack
I launched react-native doctor
I am on MacBookPro, Darwin Kernel Version 19.6.0, macOS Catalina 10.15.7
Someone can help me please
Edit: I solved my problem I used this commande
./gradlew clean
in android repository In android/gradle.properties I have this options :and I launch
react-native run-android
command without option--deviceId=${id_device}
because this option make error--deviceId=${id_device}
I hope this comment will help you
I think this has been fixed, I have “react-native-reanimated”: “^1.1.0”, and I’m no longer seeing it. Please update to the latest version .