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.
Related
I wanted:
Code coverage to run reliably against the instrumented tests
Tests to be isolated from each other
I'm new to Android development, but experienced with other development and tooling.
So I looked for the documented options and added the following to my build.gradle:
android {
defaultConfig {testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments clearPackageData: 'true'
testInstrumentationRunnerArguments useTestStorageService: 'true'
}
buildTypes {
debug {
testCoverageEnabled true
}
}
I also have a custom task to generate the report:
task coverageReport(type: JacocoReport) {
sourceDirectories.setFrom(fileTree(
dir: "$project.buildDir/src/main/java"
))
classDirectories.setFrom(fileTree(
dir: "$project.buildDir/build/intermediates/javac/debug",
))
executionData fileTree(dir: project.buildDir, includes: [
"outputs/code_coverage/debugAndroidTest/connected/*/*.ec"
])
}
Now what I see when running the tests and generating the report, is that about 10% of the time it hits what looks like a corrupted .ec file. (the rest of the time, the report is fine)
> ./gradlew coverageReport
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:coverageReport'.
> Unable to read execution data file app/build/outputs/code_coverage/debugAndroidTest/connected/Nexus_S_API_33(AVD) - 13/com.example.coverage.ExampleInstrumentedTest#useAppContext.ec
Digging into the stack trace:
Caused by: : Unable to read execution data file app/build/outputs/code_coverage/debugAndroidTest/connected/Nexus_S_API_33(AVD) - 13/com.example.coverage.ExampleInstrumentedTest#useAppContext.ec
at org.jacoco.ant.ReportTask.loadExecutionData(ReportTask.java:518)
...
Caused by: java.io.IOException: Unknown block type 3.
at org.jacoco.core.data.ExecutionDataReader.readBlock(ExecutionDataReader.java:119)
at org.jacoco.core.data.ExecutionDataReader.read(ExecutionDataReader.java:93)
at org.jacoco.core.tools.ExecFileLoader.load(ExecFileLoader.java:60)
at org.jacoco.ant.ReportTask.loadExecutionData(ReportTask.java:516)
I've seen several other numbers in other projects for the unknown block type, but so far only 3 for this minimal example project.
MD5 sums are the same for the .ec files on and off the device:
> adb shell md5sum /data/media/0/googletest/internal_use/data/data/com.example.coverage/coverage_data/com.example.coverage.ExampleInstrumentedTest#useAppContext.ec
89c6b7ac8ad27d4d2f19dce0ac47f028 /data/media/0/googletest/internal_use/data/data/com.example.coverage/coverage_data/com.example.coverage.ExampleInstrumentedTest#useAppContext.ec
> md5sum app/build/outputs/code_coverage/debugAndroidTest/connected/Nexus_S_API_33\(AVD\)\ -\ 13/com.example.coverage.ExampleInstrumentedTest#useAppContext.ec
89c6b7ac8ad27d4d2f19dce0ac47f028 app/build/outputs/code_coverage/debugAndroidTest/connected/Nexus_S_API_33(AVD) - 13/com.example.coverage.ExampleInstrumentedTest#useAppContext.ec
Re-running the tests will generally clear the issue on this project. On a larger project, several tests fail like this on each run - different tests each time, though apparently some more than others. It doesn't appear to be linked to the running time of the test.
I tried different versions of:
Gradle (7.4, 7.5, 8.0-rc-1, 8.0-rc-2)
AGP (7.4, 8.1.0-alpha01)
Android Studio (Eel, Giraffe)
emulator SDK version (27, 31, 33)
with the same failing on each.
Syncing with Gradle files and cleaning/rebuilding don't help, and I've seen this happen on the first run of a new project.
I can see that:
Gradle support for Android lags (the new JaCoCo aggregate report plugin is explicitly not supported on Android)
Gradle's had and fixed some similar issues with JaCoCo in recent releases (e.g. https://github.com/gradle/gradle/issues/20532)
a similar issue's been seen with JaCoCo in other contexts (e.g. JaCoco MVN unknown block type which suggests the JVM's being hard-killed between tests)
Turning off clearPackageData doesn't stop these failures.
I was expecting code coverage of instrumented tests to be a core tool in my development process. So far it looks like either this error is a "me" problem, or Android devs don't see much value in having this working reliably. Any insights into why it's not that valuable or can be easily replaced would be as welcome as a fix.
Debug version is compiling just fine, however release fails on task app:mergeDexRelease.
I tried so far excluding group in gradle, but without success.
I checked also this Failed to build a React Native signed release but there is no direct answer to how to solve the problem.
I cleaned gradle cache, build folder, removed node_modules and yarn.lock and reinstaled everything
I tried to restart pc
The same error appears for 3 packages: react-native-screens, react-native-safe-area-context, react-native-gesture-handler
Caused by: com.android.tools.r8.internal.a: Type com.facebook.react.viewmanagers.RNGestureHandlerButtonManagerDelegate is defined multiple times: /Users/user/Projects/app/android/app/build/intermediates/project_dex_archive/release/out/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.dex, /Users/user/Projects/app/node_modules/react-native-gesture-handler/android/build/.transforms/8bd7a67ad8066031ac26f199a2fda1a8/transformed/classes/classes.dex
at com.android.tools.r8.internal.tQ.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:14)
at com.android.tools.r8.internal.tQ.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:22)
at com.android.tools.r8.internal.xK.b(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:7)
at com.android.tools.r8.internal.xK.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:23)
at com.android.tools.r8.internal.xK.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:10)
at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048)
at com.android.tools.r8.internal.xK.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:6)
at com.android.tools.r8.graph.z2$a.e(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:4)
at com.android.tools.r8.dex.b.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:105)
at com.android.tools.r8.dex.b.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:28)
at com.android.tools.r8.D8.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:26)
at com.android.tools.r8.D8.d(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:593)
at com.android.tools.r8.D8.b(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:1)
at com.android.tools.r8.internal.ci.a(R8_3.2.47_ebadcf1df6fbed6005a238b8399b2cd411e753b60758261060e399f9498872a5:24)
... 36 more ```
Answering to myself, the key was to remove
apply plugin: "com.facebook.react"
from app/build gradle.
I also removed react {} block from app/build.gradle.
Can be closed.
As the error indicate, then the class com.facebook.react.viewmanagers.RNGestureHandlerButtonManagerDelegate is defined multiple times. From what I can see it is defined both in the app itself (/Users/user/Projects/app/android/app/build/intermediates/project_dex_archive/release/out/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.dex) and in a module (/Users/user/Projects/app/node_modules/react-native-gesture-handler/android/build/.transforms/8bd7a67ad8066031ac26f199a2fda1a8/transformed/classes/classes.dex). You will have to ensure that there are not two definitions.
The reason this works in debug mode is that the build of the app does not do a full merge of the DEX flies, but just copies in a number of DEX files into the debug APK.
For D8/R8 reference the retrced stacktrace is
Caused by: com.android.tools.r8.utils.AbortException: Type com.facebook.react.viewmanagers.RNGestureHandlerButtonManagerDelegate is defined multiple times: /Users/user/Projects/app/android/app/build/intermediates/project_dex_archive/release/out/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.dex, /Users/user/Projects/app/node_modules/react-native-gesture-handler/android/build/.transforms/8bd7a67ad8066031ac26f199a2fda1a8/transformed/classes/classes.dex
at com.android.tools.r8.utils.Reporter.handleDiagnostic(Reporter.java:81)
at com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:127)
at com.android.tools.r8.utils.ProgramClassCollection.reportDuplicateTypes(ProgramClassCollection.java:74)
at com.android.tools.r8.utils.ProgramClassCollection.lambda$defaultConflictResolver$1(ProgramClassCollection.java:68)
at com.android.tools.r8.utils.ProgramClassCollection.lambda$create$0(ProgramClassCollection.java:28)
at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048)
at com.android.tools.r8.utils.ProgramClassCollection.create(ProgramClassCollection.java:27)
at com.android.tools.r8.graph.LazyLoadedDexApplication$Builder.build(LazyLoadedDexApplication.java:266)
at com.android.tools.r8.dex.ApplicationReader.read(ApplicationReader.java:184)
at com.android.tools.r8.dex.ApplicationReader.read(ApplicationReader.java:134)
at com.android.tools.r8.dex.ApplicationReader.read(ApplicationReader.java:104)
at com.android.tools.r8.D8.readApp(D8.java:177)
at com.android.tools.r8.D8.run(D8.java:201)
at com.android.tools.r8.D8.lambda$run$1(D8.java:126)
at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:80)
I've updated to MacOS Catalina. This morning while I was working on my Android project, it suddenly started giving the following exception: "ERROR: Cause: error=86, Bad CPU type in executable".
I suspect it it because I updated to macOS 10.15 AND because I tried to build the APK for my project (so it rebuilt the renderscript stuff). Here is the full stack trace given:
org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/Users/name/Library/Android/sdk/build-tools/28.0.3/arm-linux-androideabi-ld''
at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:232)
at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:209)
at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:356)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:86)
at org.gradle.internal.operations.CurrentBuildOperationPreservingRunnable.run(CurrentBuildOperationPreservingRunnable.java:38)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:748)
Caused by: net.rubygrapefruit.platform.NativeException: Could not start '/Users/name/Library/Android/sdk/build-tools/28.0.3/arm-linux-androideabi-ld'
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
at org.gradle.process.internal.ExecHandleRunner.startProcess(ExecHandleRunner.java:97)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:70)
... 7 more
Caused by: java.io.IOException: Cannot run program "/Users/name/Library/Android/sdk/build-tools/28.0.3/arm-linux-androideabi-ld" (in directory "/Users/name/Documents/Projects/onlinetrucks_android/MyApplication/app"): error=86, Bad CPU type in executable
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
... 10 more
Caused by: java.io.IOException: error=86, Bad CPU type in executable
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 11 more
and on doing a Gradle Sync, I get
warning: Linking two modules of different target triples: /Users/name/Library/Android/sdk/build-tools/28.0.3/renderscript/lib/bc/x86/libclcore.bc' is 'armv7--linux-android' whereas '/Users/name/Documents/Projects/onlinetrucks_android/MyApplication/app/build/generated/res/rs/debug/raw/bc32/singlesource.bc' is 'armv7-none-linux-gnueabi'
and
Execution failed for task ':app:compileDebugRenderscript'.
A problem occurred starting process 'command '/Users/name/Library/Android/sdk/build-tools/28.0.3/arm-linux-androideabi-ld''
Is there a way to force Android studio to try and use the 64-bit compliant versions of the libraries instead? Any help would be appreciated, as a huge part of the project depends on Renderscript.
Additional notes:
I do not use androidX in this project, as it messes up renderscript and then causes it to NOT be compatible for Google Play's 64-bit requirement.
The renderscript part in my gradle file looks like:
renderscriptTargetApi 22
renderscriptSupportModeEnabled true
To anyone having the same issue, this is a bug. When using renderscript, the linker uses the 32 bit file. Multiple bugs have been logged. If you want to keep track, you can follow what is happening over here:
https://issuetracker.google.com/issues/142590626
Holding thumbs that they fix it soon!
UPDATE: They have fixed it in the latest buildtools version 29.0.3. You also need to update to Android Studio 3.6 to use it.
BONUS: For anyone else trying to update to AndroidX AS WELL - Renderscript might break on Android6. There is a workaround (as far as I can tell) where you set renderscriptSupportModeEnabled to false - but it doesnt fix it for ALL devices (eg. Xiomi Redmi go - Android 8.1 - then breaks for me).
I am using Android studio 4.0, and this issue got fixed for me by just updating the gradle version.
In build.gradle of app:
- ext.gradle_version = '3.5.3'
+ ext.gradle_version = '4.0.0'
And in gradle/wrapper/gradle-wrapper.properties:
- distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
+ distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
I have just upgraded to com.android.tools.build:gradle:3.0.1 and latest Android Studio stable version(3.0.1) and suddenly my espresso tests won't run. I get the following error and don't have any idea about what it means. Any suggestions?
[Device]: Error during Sync: Broken pipe
com.android.ddmlib.InstallException: Broken pipe
at com.android.ddmlib.Device.installPackage(Device.java:914)
at com.android.builder.testing.ConnectedDevice.installPackage(ConnectedDevice.java:122)
at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:126)
at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:52)
Caused by: java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
at sun.nio.ch.IOUtil.write(IOUtil.java:65)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
at com.android.ddmlib.AdbHelper.write(AdbHelper.java:927)
at com.android.ddmlib.SyncService.doPushFile(SyncService.java:699)
at com.android.ddmlib.SyncService.pushFile(SyncService.java:408)
at com.android.ddmlib.Device.syncPackageToDevice(Device.java:954)
at com.android.ddmlib.Device.installPackage(Device.java:910)
from this link and it is an old link but may still help. The solution
Try this: - change this url according to latest version in gradle-wrapper.properties and then change gradle.
distributionUrl=https://services.gradle.org/distributions/gradle-4.5.1-all.zip
Hope it helps Thanks
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'
}
}