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'
}
}
Related
when I run my program its throwing "ssl error" and "remote host terminated the handshake".
Currently I am using the below library in build.gradle. I have tried upgrading to 5.2.5 but in its website it shows they have stopped the service. Even tried other methods but nothing worked. How can I solve this?
repositories
{
url "https://mint.splunk.com/gradle/"
}
dependency
{
implementation 'com.splunk.mint:mint:4.4.0'
}
1)Tried adding
System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2");
removed .gradle and .idea and ran the code
changed the sdk
accept non-trusted certificates automatically
added
systemProp.http.proxyHost=x
systemProp.https.proxyPort=y
systemProp.https.proxyHost=x
systemProp.http.proxyPort=y
but this throws error as x is not recognised
I want to test our app with detox. On IOS it works fine, but it doesn't work yet on Android.
So when I run the detox test the simulator will open, but the app won't be started. In the logs is stated that the build was successful. Besides that when the test have failed, I can open the app on the simulator and everything works. (The tests are not ready started yet, they are in the setup fase when the issue happens)
This is the error message I get:
DetoxRuntimeError: Failed to run application on the device
HINT: Most likely, your tests have timed out and called
detox.cleanup() while it was waiting for "ready" message (over
WebSocket) from the instrumentation process.
at EmulatorDriver._getInstrumentationCrashError (/Users/corinejanssen/PycharmProjects/de-selfcare/frontend/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:175:12)
at EmulatorDriver.instrumentationCloseListener (/Users/corinejanssen/PycharmProjects/de-selfcare/frontend/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:142:67)
at EmulatorDriver._terminateInstrumentation (/Users/corinejanssen/PycharmProjects/de-selfcare/frontend/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:166:12)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async ChildProcess. (/Users/corinejanssen/PycharmProjects/de-selfcare/frontend/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:266:7)
{ name: 'DetoxRuntimeError' }
Versions I use:
Detox: 16.2.0
jest: 25.0.1
node: 12.16.0
Is someone who has this issue and solved it?
I solved this issue, by trying a lot of things. I think it was related to a missing dependency in the android/build.gradle.
For the exactness I put all the dependencies we add to this file:
dependencies {
classpath "com.android.tools.build:gradle:3.4.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
}
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
Recently I had to switch to Android Studio 3.2 Canary to use the new AndroidX components.
My main development environment is Mac/OSX and everything works fine. However, this week I had to switch to Windows and when compiling the apk I'm getting the below exception.
As I'm using AndroidX, had to enable in gradle.properties file:
android.enableJetifier=true
android.useAndroidX=true
Here's the exception.
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\rafael.chagas\.gradle\caches\transforms-1\files-1.1\jetified-play-services-basement-15.0.1.aar\a98f8e9d46ed106e8653ab19e7672193\jars\classes.jar
at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:877)
at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.lambda$convertToDexArchive$7(DexArchiveBuilderTransform.java:802)
at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
at com.android.builder.dexing.D8DexArchiveBuilder.getExceptionToRethrow(D8DexArchiveBuilder.java:124)
at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:101)
at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:872)
... 6 more
Caused by: java.lang.NullPointerException: entry
at java.util.zip.ZipFile.getInputStream(ZipFile.java:346)
at com.android.tools.r8.ArchiveClassFileProvider.getProgramResource(ArchiveClassFileProvider.java:91)
at com.android.builder.dexing.r8.CachingArchiveClassFileProvider.lambda$getProgramResource$0(CachingArchiveClassFileProvider.java:38)
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
at com.android.builder.dexing.r8.CachingArchiveClassFileProvider.getProgramResource(CachingArchiveClassFileProvider.java:38)
at com.android.builder.dexing.r8.ClassFileProviderFactory$OrderedClassFileResourceProvider.getProgramResource(ClassFileProviderFactory.java:78)
at com.android.tools.r8.utils.ClassProvider$ClassFileResourceReader.collectClass(ClassProvider.java:97)
at com.android.tools.r8.utils.ClassMap$ConcurrentClassLoader.get(ClassMap.java:241)
at com.android.tools.r8.utils.ClassMap$ConcurrentClassLoader.get(ClassMap.java:217)
at com.android.tools.r8.utils.ClassMap.get(ClassMap.java:115)
at com.android.tools.r8.graph.LazyLoadedDexApplication.definitionFor(LazyLoadedDexApplication.java:47)
at com.android.tools.r8.graph.AppInfo.definitionFor(AppInfo.java:62)
at com.android.tools.r8.ir.desugar.InterfaceMethodRewriter.findDefinitionFor(InterfaceMethodRewriter.java:255)
at com.android.tools.r8.ir.desugar.InterfaceMethodRewriter.rewriteMethodReferences(InterfaceMethodRewriter.java:140)
at com.android.tools.r8.ir.conversion.IRConverter.rewriteCode(IRConverter.java:675)
at com.android.tools.r8.ir.conversion.IRConverter.convertMethodToDex(IRConverter.java:346)
at com.android.tools.r8.graph.DexClass.forEachMethodThrowing(DexClass.java:132)
at com.android.tools.r8.ir.conversion.IRConverter.lambda$convertClassesToDex$2(IRConverter.java:332)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:117)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:38)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:77)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:260)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:66)
at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:36)
at com.android.tools.r8.ir.conversion.IRConverter.convertClassesToDex(IRConverter.java:330)
at com.android.tools.r8.ir.conversion.IRConverter.convertToDex(IRConverter.java:245)
at com.android.tools.r8.D8.optimize(D8.java:202)
at com.android.tools.r8.D8.run(D8.java:162)
at com.android.tools.r8.D8.lambda$run$1(D8.java:92)
at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:56)
at com.android.tools.r8.utils.ExceptionUtils.withD8CompilationHandler(ExceptionUtils.java:41)
at com.android.tools.r8.D8.run(D8.java:89)
at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:99)
The target .jar file above is random. It may fail with any of the project libraries.
I know that this is a Canary release of Android Studio, but what intrigues me is that this only occurs with Windows OS. Tested in Linux, OSX and had no problems at all.
Thanks!
Finally I found the root cause and fix to this issue.
Looking into the error messages, the Android R8 class causing the exception was:
src/main/java/com/android/tools/r8/ArchiveClassFileProvider.java
Digging into R8 source i found the latest logs and a brand new commit that changes the encoding while reading .zip files:
https://r8.googlesource.com/r8/+/a26659a1d07b4dc4ad0c3f8dbafd47d49efbc438
This commit changes the way R8 reads zip archives using UTF-8 encoding and avoid using the platform encoding. That's why only Windows was failing.
I tested the latest R8 release with that commit and it worked! Just need to add these (+) lines to your project build.gradle file.
repositories {
google()
jcenter()
+ maven {
+ url "http://storage.googleapis.com/r8-releases/raw"
+ }
}
dependencies {
+ classpath 'com.android.tools:r8:1.2.28'
classpath 'com.android.tools.build:gradle:3.2.0-alpha18'
classpath 'com.google.gms:google-services:4.0.0'
}
The "com.android.tools:r8:1.2.28" must be the first one in the dependencies.
According to the BUG 109992855 that new version of R8 will be pushed to Android Studio 3.2 in about two weeks. Meanwhile you must use the above fix.
Hope that helps anyone who stumbled on this error.
I am implementing RazorPay android checkout. I followed Razorpay Android sdk doc. When running app gradle build fails with this error. I have posted that on RazorPay also.
Exception in thread "main" java.lang.NullPointerException: Couldn't find outer class com/razorpay/Y_$B$ of com/razorpay/Y_$B$$5
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:1079)
at com.google.devtools.build.android.desugar.ClassVsInterface.isOuterInterface(ClassVsInterface.java:56)
at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitOuterClass(InterfaceDesugaring.java:246)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:638)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:477)
at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:361)
at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:314)
at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:711)
If some developer faced this issue, please tell me a solution.
I have no code to show, its only picked from above razorpay doc.
I found solution after searching a lot.
This issue occurred after updating to new Android Studio and build:gradle. This is not RazorPay sdk issue.
Similar issue is reported in google tracker
To solve this, just downgrade build.gradle version in your project level build.gradle.
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
...
}
}
This resolved my issue. Hope will do for you too.
You can try adding android.enableD8.desugaring = true to gradle.properties