I was working with android jetback after add recycle view with androidx and databinding and live datait started showing
android.support.v4.app.INotificationSideChannel$Stub.
I have tried a lot of solutions so far but nothing has helped. Why does it show this error when I am not using any support library and what can I do to solve it?
update :
after retracing my steps i removed the data binding and every thing worked fine can any one explain
Here is my gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.ahmedmubarak.pixeapp"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
implementation 'androidx.recyclerview:recyclerview:1.0.0-beta01'
implementation 'androidx.cardview:cardview:1.0.0-beta01'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0-beta01'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.android.volley:volley:1.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
}
I added this to build.gradle to remove the error
configurations {
implementation {
exclude group: 'com.android.support', module: 'support-v4'
}
}
Unfortunately, I predict that you'll see a new error (at run-time) like this:
java.lang.NoClassDefFoundError: Failed resolution of:
I believe this is an AndroidX issue that occurs with lots of support libraries that have yet to be updated to support AndroidX.
I have a similar problem. In my case, it was because I am using Glide library and androidx. This solution works for me:
Set enableJetifier value to true
Update Gradle build tool to 3.3.0-alpha08 with Gradle version 4.9
source
Related
I was following the android lessons on codelabs and they were introducing databinding. According to the code, all i needed to do was to enable databinding within the build.gradle file as below:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.lesson4"
minSdkVersion 18
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'
}
}
dataBinding {
enabled = true
}
}
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.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
However, the project fails to build into the emulator, and I am presented with the error code: Unable to load class 'javax.xml.bind.JAXBException'.
I also went further to amend the XML file of activity_main to wrap the ConstraintLayout within a Layout tag, but I think the error is somewhere within the gradle build portion instead.
I have tried various methods, such as apply plugin: 'kotlin-kapt' as well as including the kotlin dependencies, but the same error still persist.
I have also tried cleaning the project and rebuilding it.
I have also tried creating a brand new project, and only enabling databinding... The same error persists.
Hope someone can enlighten me about how to get databinding working in intellij for android?
Upon some research I have found that data binding will throw errors while using Java 9+.
All you have to do is set your Java to version 8 and it should work.
I don't want to use Java 8
Then you have to manually add the JAX-B dependencies
kapt "com.sun.xml.bind:jaxb-core:2.3.0.1"
kapt "javax.xml.bind:jaxb-api:2.3.1"
kapt "com.sun.xml.bind:jaxb-impl:2.3.2"
annotationProcessor "com.sun.xml.bind:jaxb-core:2.3.0.1"
annotationProcessor "javax.xml.bind:jaxb-api:2.3.1"
And apply the kotlin-kapt plugin with:
apply plugin: 'kotlin-kapt'
After implementing Firebase Cloud Messaging to my project I was getting an error during a run time Failed to merge manifest, so I migrate my app to Androidx. After migrating to androidx I'm getting this error
"Cannot specify -processorpath or --processor-path via CompileOptions.compilerArgs. Use the CompileOptions.annotationProcessorPath property instead."
My build.gradle(Module: app) file
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "android.example.com.squawker"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation ('com.google.firebase:firebase-messaging:20.0.0')
{force= true}
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.2'
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'
}
The problem is here.Remove this line from code.
apply plugin: 'android-apt'
And use only this plugin.
apply plugin: 'com.android.application'
From Android Gradle plugin version 2.2 or above android-apt is deprecated for this versions and all functionality that was previously provided by android-apt is now available in the Android plugin. You can read more about this from here.
Android newbie here. I don't know why but I can't add specific items/elements to the activity_main.xml (NestedScrollView, CardViev, Google MapView, etc). If I try to add, let's say Google MapView, a message appears that says this :
This operation requires the library com.google.android.gms:play-services-maps:+.
Problem: Inconsistencies in the existing project dependencies found.
Version incompatibility between:
- com.google.android.material:material:1.0.0
and:
- androidx.appcompat:appcompat:1.0.0
With the dependency:
- org.mockito:mockito-core:1.9.5
versus:
- org.mockito:mockito-core:2.19.0
The project may not compile after adding this library.
Would you like to add it anyway?.
Does anybody know what seems to be the problem? Build.gradle is displayed below.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 25
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"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'com.google.android.material:material:1.0.0'
}
The first of your problems is that you try to use Views, items, constants, etc, of a library that does not exist in your project, with these implementations it is more than enough for you to move forward, the problem with mockito is that you possibly implemented two versions and maybe the first version uses discontinued components, and therefore. Gradle will always look for the latest version, however both libraries need to live together, I recommend that you remove mockito 1.9.5 and try to synchronize again, I hope it was helpful , good luck!
apply plugin: 'com.google.gms.google-services'
dependencies{
implementation 'com.google.android.gms:play-services-cast-framework:10.0.1'
}
I recently updated my Android Studio from 2.3.3 to 3.2 but unfortunately it have been two days, that I'm trying to fix bugs but, I resolved the most but I still have some problems that persist in my projects:
The gradle build keep showing me this error about Kotlin version:
The Android Gradle plugin supports only Kotlin Gradle plugin version
1.2.51 and higher. Project 'XXX' is using version 1.1.4-3.
=> The problem is my kotlin is declared as automated update version :
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
I don't know where can I change the version as they mention.
This line code is always underlined in red:
implementation 'com.android.support:appcompat-v7:28.0.0'
The build tool version is 28.0.2
The error declared is:
all com.android.support libraries must use the exact same version specification.
PS: I used 28.0.0 is all com.android.support libraries.
If you have any solutions to this two problems please let me know.
Thank you in advance.
Here is my build file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.firebase.firebase-crash'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
buildToolsVersion '28.0.2'
defaultConfig {
applicationId "com.ameerhamza6733.directmessagesaveandrepost"
minSdkVersion 17
targetSdkVersion 28
versionCode 32
versionName "1.0.32"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation project(':easy_sharedpreference_library')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'org.jsoup:jsoup:1.10.3'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.github.lolucosmin:PermissionsWrapper:version_1.2'
implementation 'com.artjimlop:altex-image-downloader:0.0.4'
implementation 'com.daimajia.numberprogressbar:library:1.4#aar'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.webianks.library:easy-feedback:1.0.2'
implementation 'com.github.clans:fab:1.6.4'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.google.android.ads.consent:consent-library:1.0.6'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.4'
testImplementation 'junit:junit:4.12'
implementation project(':library')
}
apply plugin: 'com.google.gms.google-services'
repositories {
mavenCentral()
google()
}
The gradle build keep showing me this error about Kotlin version:
Answer
Open your project level build.gradle file,
there you'll find a block named buildscript.
Go to that block and find if there is a variable named ext.kotlin_version
Change it to your latest version of Kotlin plugin.
all com.android.support libraries must use the exact same version
specification.
Issue for this is that the library you're using easy-feedback is having different version for support library (v25) than you're using (v28).
Solution is to exclude your support library from that dependency like below:
implementation ('com.webianks.library:easy-feedback:1.0.2', {
exclude group: 'com.android.support'
})
Note : If problem still persist, then check it with other 3rd party dependencies too.
but when I build it gives me an error
recently android updated for kotlin
and my android gradle vesion is 3.1.2
and kotlin version is 1.2.41
android studio 3.1.2
i'm targeting android p
this is latest version so i can't find more documentation on this problem and
please help me to find out this problem
android issues
Program type already present: android.support.v4.media.MediaBrowserCompat$ConnectionCallback$StubApi21
build.gradle(app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 'android-P'
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.xxxxxxx.xx"
minSdkVersion 18
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
debuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'org.jetbrains.anko:anko-commons:0.10.4'
implementation 'androidx.core:core-ktx:1.0.0-alpha1'
implementation "androidx.appcompat:appcompat:1.0.0-alpha1"
implementation "androidx.legacy:legacy-support-v4:1.0.0-alpha1"
implementation 'androidx.constraintlayout:constraintlayout:1.1.0'
implementation "com.google.android.material:material:1.0.0-alpha1"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha1'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
//firebase massaging
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.firebase:firebase-core:15.0.2'
def lifecycle_version = "2.0.0-alpha1"
def room_version = "2.0.0-alpha1"
// ViewModel and LiveData
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
// room database persistent
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
// optional - Test helpers for LiveData
testImplementation "androidx.arch.core:core-testing:$lifecycle_version"
//data binding
//kapt 'com.android.databinding:compiler:3.1.2'
}
apply plugin: 'com.google.gms.google-services'
please help me what is problem I can't find out
i removed Androidx from my whole project but isue still parsist then
i found solution and replace
implementation 'androidx.core:core-ktx:1.0.0-alpha1'
to
implementation 'androidx.core:core-ktx:0.3'
and my problem is solved.
anyway thanks all second-time I'm going to use androidx (Android + Kotlin)
I'm waiting for jetpack stable version.
Actually this is a bug in Canary 14. You should wait for Canary 15 ;-)
Check out this session.
have you tried downloading android studio 3.2 canary 14? there is a new option to convert your files to androidX and will give you a preview of what it's going to do. Back up your files or at least use git to make sure it's safe.
thanks for the edit paul