I am trying to link my app with firebase messaging services it compiled with this warning:
INFO: API '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 more information.
Affected Modules: app
When I run the I get the following error:
*Cannot specify -processorpath or --processor-path via `CompileOptions.compilerArgs`. Use the `CompileOptions.annotationProcessorPath` property instead.*
**My app gradle content is:**
apply plugin: 'com.android.application'
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "android.example.com.squawker"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'androidx.appcompat:appcompat:1.0.0'
testImplementation 'junit:junit:4.12'
// RecyclerView
implementation 'androidx.recyclerview:recyclerview:1.0.0'
// Schematic dependencies for ContentProvider
apt 'net.simonvt.schematic:schematic-compiler:0.6.3'
implementation 'net.simonvt.schematic:schematic:0.6.3'
// Preferences Dependencies
implementation 'androidx.preference:preference:1.0.0'
implementation 'com.google.firebase:firebase-messaging:20.1.3'
}
My project gradle content is:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2'
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I solved my problem with following setps below:
1- Remove android-apt plugin by deleting the line below:
apply plugin: 'android-apt'
2- Change apt to implementation
So apt 'net.simonvt.schematic:schematic-compiler:0.6.3'
become implementation 'net.simonvt.schematic:schematic-compiler:0.6.3'
Then the app crashes after implementing the 2 steps above:
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.example.com.myProject.provider.generated........Provider"
3- I fixed this error with adding this code in app gradle file:
android {
.........
..........
defaultConfig {
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
.....
....
}
Related
I get this error when trying to sync my android studio project after adding the lines required in a firebase project.
Just that, it's a common android studio project in which i just want to apply a firebase database. Please, if anyone knows what could be happening?
Thanks.
PD: I already searched this error on other stackoverflow questions, but none of the answers worked for me :(
Here is my build.gradle(Project):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.3.4'
//classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And my buid.gradle(app):
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.example.proceedingmanager"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation platform('com.google.firebase:firebase-bom:26.2.0')
implementation 'com.google.firebase:firebase-analytics'
}
Update:
Hey! I solved it by just updating my android studio version to a newer one.
But no, i don't know how to solve it without doing that
If i tap the Debug Icon, Android Studio sometimes automatically creates new BuildConfig files and then complains that it should be only one named Buildconfig.java...
A Clean Project fixes it but it is so annoying that there must be a reliable solution.
Thanks in advance
EDIT:
My build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My build.gradle(Module: app):
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "de.my.app.id"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
// To inline the bytecode built with JVM target 1.8 into
// bytecode that is being built with JVM target 1.6. (e.g. navArgs)
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.navigation:navigation-fragment:2.2.2'
implementation 'androidx.navigation:navigation-ui:2.2.2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.github.siyamed:android-shape-imageview:0.9.3#aar'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.github.RobertApikyan:SegmentedControl:1.2.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'com.h6ah4i.android.materialshadowninepatch:materialshadowninepatch:1.0.0'
}
EDIT:
I get this error warning in my console when i build & debug:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
Try following ways in order of listing:
Select Make Project from Build menu.
Go to File menu and select Invalidate Cache/restart.
Change the distributionUrl in gradle-wrapper.properties to some other versions (higher one preferred).
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
Update Android studio.
I tried to implement oneSignal into my apps but I got error that said
ERROR: In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[10.2.
1, 16.0.99]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.onesignal:OneSignal:3.12.3 -> com.google.android.gms:play-services-location#[10.2.1, 16.0.99], b
ut play-services-location version was 15.0.1.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto com.google.android.gms:play-services-location#{strictly 15.0.1}
-- Project 'app' depends onto com.onesignal:OneSignal#{strictly 3.12.3}
For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b
uild.gradle file.
here is my gradle class
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.4, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.gerobokgo"
minSdkVersion 26
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.Test.runner.AndroidJUnitRunner"
manifestPlaceholders = [
onesignal_app_id: '560003c8-bceb-4896-bf78-435948f4fc6d',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE'
]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.4'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.firebaseui:firebase-ui-database:4.3.2'
implementation 'com.google.firebase:firebase-storage:16.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
//Layout
implementation 'com.google.android.material:material:1.0.0'
//recylervieer
implementation 'androidx.recyclerview:recyclerview:1.0.0'
// image slider
implementation 'com.github.therealshabi:AutoImageFlipper:v1.4.1'
//image Cropper
implementation 'com.theartofdev.edmodo:android-image-cropper:2.1.+'
implementation 'androidx.work:work-runtime:2.2.0'
implementation 'com.braintreepayments:card-form:3.1.1'
//onesignal
implementation 'com.onesignal:OneSignal:[3.11.2, 3.99.99]'
}
I had the same problem in a Kotlin project here, the solution was to add implementation 'androidx.fragment:fragment-ktx:1.2.2' dependency to my module's build.gradle file.
I have solved the problems.
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.4, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
just put these code on the top and sync it
For those who are using react-native version 0.60 or above one signal and intervase firebase module makes same problem. As #last gg post above,
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
copy this very top of your android/app/build.gradle file. Then rebuild your android app.
This Worked For Me
//Add One Signal Plugin At the TOP before Google GSM Plugin
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
//Add this after Plugin
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]'
}
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.1"
defaultConfig {
applicationId "com.example.example"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
android {
defaultConfig {
manifestPlaceholders = [onesignal_app_id : "******************",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "**************"]
}
}
}
repositories {
mavenCentral()
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions{
checkReleaseBuilds false
abortOnError false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
//Firebase Dependancy
implementation 'com.google.firebase:firebase-analytics:17.4.1'
//Onesignal Dependancy
implementation 'com.onesignal:OneSignal:[3.6.5, 3.99.99]'
}
I've tried to download RecycleView in order to use in my project but this error keeps occurring and download fails.
Gradle sync failed: Could not resolve all dependencies for
configuration ':app:debugRuntimeClasspath'. Could not determine
artifacts for androidx.recyclerview:recyclerview:1.0.0 Could not
get resource
'https://dl.google.com/dl/android/maven2/androidx/recyclerview/recyclerview/1.0.0/recyclerview-1.0.0.aar'.
Could not HEAD
'https://dl.google.com/dl/android/maven2/androidx/recyclerview/recyclerview/1.0.0/recyclerview-1.0.0.aar'.
Remote host closed connection during handshake SSL peer shut
down incorrectly Consult IDE log for more details (Help | Show Log)
(12 s 965 ms)
This is the Project Build Gradle:
buildscript {
repositories {
jcenter()
mavenCentral()
google()
maven { url 'http://repo.maven.apache.org/maven2' }
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and this is the Module:App build Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.aden.adenmarket"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.google.firebase:firebase-firestore:20.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
Since no one answered my question, I'll post this answer. Maybe it'll help someone who may face an issue like this. I solved this problem by updating Firebase libraries and
updating these two dependencies to the last version and it worked successfully .
//module:app
implementation 'com.google.firebase:firebase-auth:18.1.0'
implementation 'com.google.firebase:firebase-firestore:20.1.0'
implementation 'com.google.firebase:firebase-core:17.0.1'
//project Build Graddle
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.3.0'
I have an android app I want to import to my project as a module. The module syncs and compiles fine with apply plugin: 'com.android.application' However, there are classes from the module that I want to use in my project. To do this, it seems like I need to switch the gradle for the module to read apply plugin: 'com.android.library' as per this question. However, changing the module from an application to a library results in the following error log:
Unable to resolve dependency for ':app#debug/compileClasspath': Failed to transform file 'OCRTest-release.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Failed to transform file 'OCRTest-release.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
...
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Failed to transform file 'OCRTest-release.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
So far I have tried invalidating caches and restarting Android Studio, as that was a common suggestion. I have also seen it suggested to delete the .gradle file altogether. Is that safe to do? Also, the main thing I want to do is be able to use Java classes from the module in my app's activities. If there is a better way to go about doing this, let me know.
Here is the code for my .gradle files.
settings.gradle:
include ':app'
include ':OCRTest'
build.gradle(Project):
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(Module: OCRTest): This is the module that contains classes I want to use in my app
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 27
}
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard.cfg'
}
}
}
dependencies {
implementation 'com.rmtheis:tess-two:9.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
}
build.gradle(Module: app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "org.noblis.thirdeye"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
matchingFallbacks = ['debug']
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.rmtheis:tess-two:9.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation project(path: ':OCRTest', configuration: 'default')
}
Remove the following line from build.gradle(Module:app):
implementation project(path: ':OCRTest', configuration: 'default')
Sync Gradle files.
Replace settings.gradle with this line:
include ':app', ':OCRTest'
Sync Gradle files again.
Now goto Project Structure>Add Module dependency and add module.
Hope this helps :)