Using Navigation component alpha09 and have added apply plugin: "androidx.navigation.safeargs" to top of base module build.gradle but getting following error when doing gradle sync. I'm using Android Studio 3.4 Canary 9 (but also had same problem using 3.3 RC3)
It looks like a related fix was included in alpha09 - https://issuetracker.google.com/issues/119662045
Caused by: kotlin.TypeCastException: null cannot be cast to non-null type org.gradle.api.resources.TextResource
at androidx.navigation.safeargs.gradle.SafeArgsPlugin.setApplicationId(SafeArgsPlugin.kt:87)
at androidx.navigation.safeargs.gradle.SafeArgsPlugin.access$setApplicationId(SafeArgsPlugin.kt:39)
at androidx.navigation.safeargs.gradle.SafeArgsPlugin$apply$1$task$1.execute(SafeArgsPlugin.kt:63)
at androidx.navigation.safeargs.gradle.SafeArgsPlugin$apply$1$task$1.execute(SafeArgsPlugin.kt:39)
at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:360)
at androidx.navigation.safeargs.gradle.SafeArgsPlugin$apply$1.invoke(SafeArgsPlugin.kt:59)
at androidx.navigation.safeargs.gradle.SafeArgsPlugin$apply$1.invoke(SafeArgsPlugin.kt:39)
at androidx.navigation.safeargs.gradle.SafeArgsPluginKt$sam$org_gradle_api_Action$0.execute(SafeArgsPlugin.kt)
at org.gradle.internal.ImmutableActionSet$SingletonSet.execute(ImmutableActionSet.java:225)
at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:247)
at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:236)
at com.android.build.gradle.LibraryExtension.addVariant(LibraryExtension.java:93)
at com.android.build.gradle.FeatureExtension.addVariant(FeatureExtension.java:121)
at com.android.build.gradle.internal.ApiObjectFactory.create(ApiObjectFactory.java:134)
Just updated to alpha11 and not seeing this issue any more. (https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0-alpha11)
UPDATE
From comments below it looks like alpha11 didn't resolve issue for some people but beta1 did
Related
Currently using react native, react-native-firebase, and react-native-push-notification. Everything was fine until suddenly today firebase messaging started causing the app to crash. The error message is the following:
Process: com.packagename, PID: 30087
java.lang.AbstractMethodError: abstract method "com.google.android.gms.tasks.Task com.google.firebase.iid.WithinAppServiceBinder$IntentHandler.zza(android.content.Intent)"
at com.google.firebase.iid.WithinAppServiceBinder.zza(com.google.firebase:firebase-iid##20.2.2:9)
at com.google.firebase.iid.zzaw.zza(com.google.firebase:firebase-iid##20.2.2:30)
at com.google.firebase.iid.zzaw.onServiceConnected(com.google.firebase:firebase-iid##20.2.2:59)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:2067)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2099)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8016)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
The error occurs when a notification is received, but does not trigger a data message. In addition, the notification is received and processed before causing the crash.
I thought the error might have been caused by changing the react-native-firebase/app version, so I reverted my project on git to that of a previous, working version. However, I still get the same error after cleaning and rebuilding. It also occurs even if there are no notification listeners set up on the react native side, although I'm not sure what that entails for the actual native code. What could possibly be the problem? I'm using versions of react-native-firebase/messaging (7.1.5) and react-native-firebase/app (7.2.0) that were previously functional.
Edit 07/09/2020: We have released firebase-iid and firebase-messaging versions 20.2.3 with a fix for this issue, please upgrade to the latest versions.
[Firebaser here] It looks like yesterday's releases of firebase-messaging and firebase-iid contain a bug which can cause this crash. We are working hard on a fix.
For now the best thing to do is to use the versions released on June 18th:
https://firebase.google.com/support/release-notes/android#2020-06-18
com.google.firebase:firebase-messaging:20.2.1
com.google.firebase:firebase-iid:20.2.1
We are working on a fix and hope to have a new release out soon. When we do I will update this answer and the release notes will be available here:
https://firebase.google.com/support/release-notes/android
We tried adding firebaseMessagingVersion = "20.2.1" into the ext section in the root project android/build.gradle which fixed it for us. We looked into the safeExtGet method and found that it would try to extract the top level variable from the root project file.
By doing it in this way we didn't need to touch the node modules.
ext {
googlePlayServicesVersion = "16.+"
firebaseVersion = "17.3.4"
firebaseMessagingVersion = "20.2.1"
}
Exact same issue with these versions. And yes they were functional before this
"#react-native-firebase/app": "^6.7.1",
"#react-native-firebase/messaging": "^6.7.1",
Issue Solved:
Go to react-native-push-notification/build.gradle
Change
def firebaseVersion = safeExtGet('firebaseVersion', '+')
to
def firebaseVersion = safeExtGet('firebaseVersion', '20.2.1')
It was picking us the version 20.2.2 which is not stable and was causing all kind of weird issues.
This upgrade fixed the issue for me
implementation 'com.google.firebase:firebase-messaging:20.2.3'
This case is working for me:
implementation "com.google.firebase:firebase-messaging:20.2.3"
implementation "com.google.firebase:firebase-analytics:17.4.4"
Ref to github issue
This issue is fixed with latest version of this dependency.
https://firebase.google.com/support/release-notes/android#messaging_v20-2-3
Currently using react native, react-native-firebase, and react-native-push-notification. Everything was fine until suddenly today firebase messaging started causing the app to crash. The error message is the following:
Process: com.packagename, PID: 30087
java.lang.AbstractMethodError: abstract method "com.google.android.gms.tasks.Task com.google.firebase.iid.WithinAppServiceBinder$IntentHandler.zza(android.content.Intent)"
at com.google.firebase.iid.WithinAppServiceBinder.zza(com.google.firebase:firebase-iid##20.2.2:9)
at com.google.firebase.iid.zzaw.zza(com.google.firebase:firebase-iid##20.2.2:30)
at com.google.firebase.iid.zzaw.onServiceConnected(com.google.firebase:firebase-iid##20.2.2:59)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:2067)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2099)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8016)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
The error occurs when a notification is received, but does not trigger a data message. In addition, the notification is received and processed before causing the crash.
I thought the error might have been caused by changing the react-native-firebase/app version, so I reverted my project on git to that of a previous, working version. However, I still get the same error after cleaning and rebuilding. It also occurs even if there are no notification listeners set up on the react native side, although I'm not sure what that entails for the actual native code. What could possibly be the problem? I'm using versions of react-native-firebase/messaging (7.1.5) and react-native-firebase/app (7.2.0) that were previously functional.
Edit 07/09/2020: We have released firebase-iid and firebase-messaging versions 20.2.3 with a fix for this issue, please upgrade to the latest versions.
[Firebaser here] It looks like yesterday's releases of firebase-messaging and firebase-iid contain a bug which can cause this crash. We are working hard on a fix.
For now the best thing to do is to use the versions released on June 18th:
https://firebase.google.com/support/release-notes/android#2020-06-18
com.google.firebase:firebase-messaging:20.2.1
com.google.firebase:firebase-iid:20.2.1
We are working on a fix and hope to have a new release out soon. When we do I will update this answer and the release notes will be available here:
https://firebase.google.com/support/release-notes/android
We tried adding firebaseMessagingVersion = "20.2.1" into the ext section in the root project android/build.gradle which fixed it for us. We looked into the safeExtGet method and found that it would try to extract the top level variable from the root project file.
By doing it in this way we didn't need to touch the node modules.
ext {
googlePlayServicesVersion = "16.+"
firebaseVersion = "17.3.4"
firebaseMessagingVersion = "20.2.1"
}
Exact same issue with these versions. And yes they were functional before this
"#react-native-firebase/app": "^6.7.1",
"#react-native-firebase/messaging": "^6.7.1",
Issue Solved:
Go to react-native-push-notification/build.gradle
Change
def firebaseVersion = safeExtGet('firebaseVersion', '+')
to
def firebaseVersion = safeExtGet('firebaseVersion', '20.2.1')
It was picking us the version 20.2.2 which is not stable and was causing all kind of weird issues.
This upgrade fixed the issue for me
implementation 'com.google.firebase:firebase-messaging:20.2.3'
This case is working for me:
implementation "com.google.firebase:firebase-messaging:20.2.3"
implementation "com.google.firebase:firebase-analytics:17.4.4"
Ref to github issue
This issue is fixed with latest version of this dependency.
https://firebase.google.com/support/release-notes/android#messaging_v20-2-3
Im working on an Android App, currently using DSL and some libraries, suddenly the build gave me this error.
Task :app:kaptDebugKotlin FAILED
ANTLR Tool version 4.7.1 used for code generation does not match the current runtime version 4.5.3ANTLR Runtime version 4.7.1 used for parser compilation does not match the current runtime version 4.5.3
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:kaptDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
java.lang.reflect.InvocationTargetException (no error message)
i've been searching but with no success...
If you wanna see the issue you can clone the project. Project GITHUB
Im using Android Studio Canary 4.1.
So the solution was from the build.gradle
basically the import from ROOM was this
import(Room.compiler)
so i changed to this, and the issue was solved :)
kapt(Room.compiler)
Inside the build.gradle(Module:app) copypaste this code
configurations.all() {
resolutionStrategy.force "org.antlr:antlr4-runtime:4.5.3"
resolutionStrategy.force "org.antlr:antlr4-tool:4.5.3"
}
For anyone still experiencing this issue, just update your Room to the latest version:
androidx.room:room-runtime:2.3.0-alpha04
androidx.room:room-compiler:2.3.0-alpha04
It's due to this bug: https://issuetracker.google.com/issues/155215201
The problem was fixed for me by changing this.
from:
implementation "androidx.room:room-runtime:$depVersion"
implementation "androidx.room:room-compiler:$depVersion"
to:
implementation "androidx.room:room-runtime:$depVersion"
annotationProcessor "androidx.room:room-compiler:$depVersion"
Removing suspend keyword from queries in DAO interface, solved my problem
I got similar error. I have all files in Java and I changed few files to Kotlin. Then this issue showed up.
I have a function in a Java file accessing static function in a Kotlin file. That's the point where the app crashed.
Code in Kotlin file:
companion object{
#JvmStatic
fun myStaticFunction(){
// body of the static function
}
}
I added the annotation #JvmStatic(see the above code) to the function and the error got resolved.
This is a very specific scenario in which this crash occurs and may not be applicable to all.
At lease for me, the root cause of this problem/error is because of the data binding not being handled properly.
Currently, Android Studio does not have a mechanism to show error message for unreferenced variables in .xml file.
For example,
In MyViewModel.kt, If I have a property name as,
var email
and you are mapping this property in xml as,
#={model.errEmail}
instead of #={model.email}
You get to see this error.
If you see this error, just go to layout xml file and check the binding names/mappings and correct it.
Had a similar issue. I was trying to implement bindingAdapters to a TextView of a ViewHolder in my recyclerview
I failed to implement a bindingAdapter for a TextView after adding the adding a unique app attribute
app:tDate="#{transaction}
in the xml layout file for my recylerView item.
<TextView
android:id="#+id/trans_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/trans_category"
app:layout_constraintTop_toTopOf="parent"
app:tDate="#{transaction}"/>
Solved it by well.. implementing it.
#BindingAdapter("tDate")
fun TextView.setValue(item: Transactions){
text = item.date.toString()
}
Since upgrading from Realm 0.83.1 to 0.85 or 0.89, I'm unable to run the app. So I'm stuck in 0.83.1 version. I'm getting this weird link error when I run on the device. I'm trying to encrypt the database, but it's only fully supported in 0.85 or higher. Any help would be appreciated!
Here is my Logcat output:
Caused by: java.lang.UnsatisfiedLinkError: No implementation found for java.lang.String io.realm.internal.Util.nativeGetTablePrefix()
(tried Java_io_realm_internal_Util_nativeGetTablePrefix and
Java_io_realm_internal_Util_nativeGetTablePrefix__)
at io.realm.internal.Util.nativeGetTablePrefix(Native Method)
at io.realm.internal.Util.getTablePrefix(Util.java:47)
at io.realm.internal.Table.(Table.java:38)
at io.realm.RealmSchema.(RealmSchema.java:40)
at io.realm.BaseRealm.(BaseRealm.java:78)
at io.realm.Realm.(Realm.java:138)
at io.realm.Realm.createAndValidate(Realm.java:269)
at io.realm.Realm.createInstance(Realm.java:249)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:114)
at io.realm.Realm.getDefaultInstance(Realm.java:195)
I tried creating an empty project and it seems to work fine, but it doesn't work on my real project. I suspect an issue with multi-dex, but I ran it on a phone with Android M and it failed the same way.
0.88.0 has changed the way of adding Realm as a dependency. So instead of:
build.gradle (app level)
.
dependencies {
compile 'io.realm:realm-android:0.87.4'
}
You have to do:
build.gradle (app level)
.
apply-plugin: 'realm-android'
build.gradle (project level)
.
buildscript {
dependencies {
classpath 'io.realm:realm-gradle-plugin:0.89.0'
}
}
I updated to SDK 23 and updated the gradle.build to API 23, support library to 23.0.0, etc and am now getting the following error when trying to run the app (compiles just fine).
java.lang.NoSuchFieldError: No instance field mFragments of type Landroid/support/v4/app/FragmentManagerImpl; in class Landroid/support/v4/app/Watson; or its superclasses (declaration of 'android.support.v4.app.Watson' appears in /data/app/com.my.app-1/base.apk)
at android.support.v4.app.Watson.onCreatePanelMenu(Watson.java:50)
at com.actionbarsherlock.ActionBarSherlock.callbackCreateOptionsMenu(ActionBarSherlock.java:560)
at com.actionbarsherlock.internal.ActionBarSherlockNative.dispatchCreateOptionsMenu(ActionBarSherlockNative.java:64)
at com.actionbarsherlock.app.SherlockFragmentActivity.onCreatePanelMenu(SherlockFragmentActivity.java:164)
at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:548)
at com.android.internal.policy.impl.PhoneWindow.doInvalidatePanelMenu(PhoneWindow.java:917)
at com.android.internal.policy.impl.PhoneWindow$1.run(PhoneWindow.java:258)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
I reverted back to API 22 on everything and still get the error.
I did the some thing as you did ,
but I found gradle can solve dependencies,
in External Libraries i cannot find support-v4-23.0.0,support-v7-23.0.0 and other lib which the version is 23.0.0.
then I reverted back to compile 'com.android.support:support-v4:22.2.0',
the problem solver #mraviator
Thank you #zmarties for the answer , I want to add the details and links
Remove 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar' from gradle
Download actionbarsherlock module from this link!
Verify that you have 'com.android.support:support-v4:20.0.0' or 23
Open the actionbarsherlock module src change FloatMath to Math in AnimatorProxy.java
Open the actionbarsherlock module src create variable fragments in class level scope as FragmentManagerImpl fragments = (FragmentManagerImpl) this.getSupportFragmentManager(); in Watson.java
Replace all mFragments occurrence with fragments variable
Thank you for the above answers .
Using google play services version 8.1.0 instead of 8.4.0 solved on my side
I found that I could build ActionBarSherlock using SDK 23 if I made the following two sets of changes:
in AnimatorProxy.java, replace FloatMath calls with their corresponding Math calls
in Watson.java, replace the use of the mFragments field with a local variable fragments initialized via getActiveFragments(null), and then change the mFragment references to use the local variable
Did you change the theme view in the main layout from the design tab?
Try changing it again to a Sherlock theme view at the design tab.
i had the same problem when import project eclipse to Android Studio
This is best solution for me
I found that I could build ActionBarSherlock using SDK 23 if I made the following two sets of changes:
in AnimatorProxy.java, replace FloatMath calls with their corresponding Math calls - i change FloatMath - to Math
in Waston Class i had the error - mFragments.isadded
So,
i replace the follow code instead of checking
mFragments.isadded != null
to
mFragments.getActiveFragments(mCreatedMenus)
everywher when it required
i had solve these issues.