gpt4 book ai didi

android - NoClassDefFoundError : Failed resolution of: Lio/realm/internal/LinkView

转载 作者:太空狗 更新时间:2023-10-29 15:50:02 26 4
gpt4 key购买 nike

我正在使用 Realm。我安装了 Stetho-Realm 来查看 Realm 数据。

这就是我所做的。

buildscript {
...
repositories {
google()
jcenter()
...
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
...
classpath "io.realm:realm-gradle-plugin:5.1.0"
}
}

allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
maven {
url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
}
}
}

应用程序等级

  • stetho:1.5.0
  • stetho_realm:2.1.0
  • 多索引:1.0.3
  • multiDexEnabled 真

这是 gradle 代码。

apply plugin: 'com.android.application'
apply plugin: 'realm-android'

android {
compileSdkVersion 27
defaultConfig {
...
minSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
...

}

dependencies {
...
// Stetho
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.uphyca:stetho_realm:2.1.0'

}

我的应用类

public class MyApp extends Application{
@Override
public void onCreate() {
super.onCreate();

Realm.init(this);
RealmConfiguration config = new RealmConfiguration.Builder().build();
Realm.setDefaultConfiguration(config);

// Stetho
Stetho.initialize(
Stetho.newInitializerBuilder(this)
.enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
.enableWebKitInspector(RealmInspectorModulesProvider.builder(this).build())
.build());
}

@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}

应用崩溃并出现此错误:在android studio上运行后,App安装正常。在应用程序出现在设备上后,我在“chrome://inspect/#devices:”中单击了“Inspect”。此时,应用程序崩溃并显示错误。如何通过 Stetho 查看 Realm 数据库?:

E/AndroidRuntime: FATAL EXCEPTION: StethoWorker-main-13
...
java.lang.NoClassDefFoundError: Failed resolution of: Lio/realm/internal/LinkView;
at java.lang.reflect.Executable.getParameterTypesInternal(Native Method)
at java.lang.reflect.Method.getParameterTypes(Method.java:179)
at java.lang.Class.getDeclaredMethods(Class.java:1881)
at com.facebook.stetho.inspector.MethodDispatcher.buildDispatchTable(MethodDispatcher.java:115)
at com.facebook.stetho.inspector.MethodDispatcher.findMethodDispatcher(MethodDispatcher.java:53)
at com.facebook.stetho.inspector.MethodDispatcher.dispatch(MethodDispatcher.java:60)
at com.facebook.stetho.inspector.ChromeDevtoolsServer.handleRemoteRequest(ChromeDevtoolsServer.java:129)
at com.facebook.stetho.inspector.ChromeDevtoolsServer.handleRemoteMessage(ChromeDevtoolsServer.java:111)
at com.facebook.stetho.inspector.ChromeDevtoolsServer.onMessage(ChromeDevtoolsServer.java:87)
at com.facebook.stetho.websocket.WebSocketSession$1.handleTextFrame(WebSocketSession.java:176)
at com.facebook.stetho.websocket.WebSocketSession$1.onCompleteFrame(WebSocketSession.java:136)
at com.facebook.stetho.websocket.ReadHandler.readLoop(ReadHandler.java:44)
at com.facebook.stetho.websocket.WebSocketSession.handle(WebSocketSession.java:45)
at com.facebook.stetho.websocket.WebSocketHandler.doUpgrade(WebSocketHandler.java:117)
at com.facebook.stetho.websocket.WebSocketHandler.handleRequest(WebSocketHandler.java:83)
at com.facebook.stetho.server.http.LightHttpServer.dispatchToHandler(LightHttpServer.java:84)
at com.facebook.stetho.server.http.LightHttpServer.serve(LightHttpServer.java:61)
at com.facebook.stetho.inspector.DevtoolsSocketHandler.onAccepted(DevtoolsSocketHandler.java:52)
at com.facebook.stetho.server.ProtocolDetectingSocketHandler.onSecured(ProtocolDetectingSocketHandler.java:63)
at com.facebook.stetho.server.SecureSocketHandler.onAccepted(SecureSocketHandler.java:33)
at com.facebook.stetho.server.LazySocketHandler.onAccepted(LazySocketHandler.java:36)
at com.facebook.stetho.server.LocalSocketServer$WorkerThread.run(LocalSocketServer.java:167)
Caused by: java.lang.ClassNotFoundException: Didn't find class "io.realm.internal.LinkView" on path: DexPathList[[zip file "/data/app/io.MyApp.app-xknjnMn3NM61rqAc4Zy3uA==/base.apk"],nativeLibraryDirectories=[/data/app/io.MyApp.app-xknjnMn3NM61rqAc4Zy3uA==/lib/arm64, /data/app/io.MyApp.app-xknjnMn3NM61rqAc4Zy3uA==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]

最佳答案

Stetho-Realm 无人维护,不支持 3.7.1 以上的 Realm 版本

但是有一个社区分支:https://github.com/wickedev/stetho-realm

repositories {
maven { url 'https://github.com/WickeDev/stetho-realm/raw/master/maven-repo' }
}

dependencies {
implementation 'com.uphyca:stetho_realm:2.3.0'
}
val realmInspector = RealmInspectorModulesProvider.builder(this)
.withDeleteIfMigrationNeeded(true)
.build()

Stetho.initialize(Stetho.newInitializerBuilder(this)
.enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
.enableWebKitInspector(realmInspector)
.build())

关于android - NoClassDefFoundError : Failed resolution of: Lio/realm/internal/LinkView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51379564/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com