我正在使用存储库中的Telegram信使的自定义版本:https://github.com/DrKLO/Telegram。我想在其中使用MPAndroidChart和realm但是当我通过这样的在线存储库添加领域时:
在gradle文件中:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:0.88.2"
}
}
在gradle模块文件中:
dependencies {
compile 'io.realm:realm-android:0.88.2'
}
repositories {
maven { url "https://jitpack.io" }
maven { // this is for realm-db
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
}
即使添加这样的jar文件并编译并运行它,我也会遇到下面的错误,当我没有添加已编译的c / c ++依赖项时,我会遇到这个错误。
手动添加 我已将与realm库相关的jar和pom文件添加到'realm_libs'文件夹中,并将以下行添加到gradle依赖项中。
compile files('realm_libs/realm-android-0.80.2.jar')
我遇到的错误:
E/art: dlopen("/data/data/org.telegram.messenger.beta/files/lib/libtmessages.17loc.so", RTLD_LAZY) failed: dlopen failed: "/data/data/org.telegram.messenger.beta/files/lib/libtmessages.17loc.so" is 32-bit instead of 64-bit
E/art: dlopen("/data/data/org.telegram.messenger.beta/files/lib/libtmessages.17loc.so", RTLD_LAZY) failed: dlopen failed: "/data/data/org.telegram.messenger.beta/files/lib/libtmessages.17loc.so" is 32-bit instead of 64-bit
E/art: No implementation found for void org.telegram.tgnet.ConnectionsManager.native_setJava(boolean) (tried Java_org_telegram_tgnet_ConnectionsManager_native_1setJava and Java_org_telegram_tgnet_ConnectionsManager_native_1setJava__Z)
E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.telegram.messenger.beta, PID: 13900
java.lang.UnsatisfiedLinkError: No implementation found for void org.telegram.tgnet.ConnectionsManager.native_setJava(boolean) (tried Java_org_telegram_tgnet_ConnectionsManager_native_1setJava and Java_org_telegram_tgnet_ConnectionsManager_native_1setJava__Z)
at org.telegram.tgnet.ConnectionsManager.native_setJava(Native Method)
at org.telegram.messenger.ApplicationLoader.onCreate(ApplicationLoader.java:268)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1017)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4938)
at android.app.ActivityThread.access$1500(ActivityThread.java:182)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1576)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5717)
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:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
I/Process: Sending signal. PID: 13900 SIG: 9
项目成功清理,我对领域库导入没有问题,但是当我在设备上运行它时会发生错误。
答案 0 :(得分:0)
问题是Telegram只支持32位机器,而域应该以32位模式编译。这可以通过使用领域的旧版本(https://static.realm.io/downloads/java/realm-java-0.87.4.zip)并按照此处的说明拆分构建来完成:
realm.io/news/reducing-apk-size-native-libraries
您必须从此link的下载部分获取jar文件,并且eclipse目录中指示不同体系结构的4个文件夹应添加到src/main/jniLibs
目录。
以下内容应添加到模块的build.gradle文件中:
android {
// Some other configuration here...
splits {
abi {
enable true
reset()
include 'x86', 'armeabi', 'armeabi-v7a', 'mips'
universalApk false
}
}
}
dependencies {
compile files('libs/realm-android-0.87.4.jar')
}