我在尝试使用Stetho时遇到了困难,我试图搜索并遵循其他人提供的步骤,但是,他们似乎都没有突出我的问题。下面是我需要的Stetho使用文件中的内容。
我的问题是,它无法识别“初始化”方法--我通过其他用户的建议尝试了其他方法来实现该方法,但是,我仍然遇到了相同的错误
build.gradle (模块: app)
dependencies {
compile 'com.facebook.stetho:stetho:1.5.0'
compile 'com.facebook.stetho:stetho-okhttp3:1.5.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
testCompile 'junit:junit:4.12'
}在我的Stetho应用课上
import android.app.Application;
public class Stetho extends Application {
@Override
public void onCreate() {
super.onCreate();
Stetho.initializeWithDefaults(this);
}
}在我的宣言中声明
<application
android:name=".Stetho"
android:allowBackup="true"我认为问题是,我实际上没有正确地实现库,但我不确定。
发布于 2017-04-16 19:09:23
您可能会遇到名称冲突,因为您的App类也被命名为Stetho。在App和.manifest文件上重命名您的.manifest类。将Stetho包导入应用程序类。
您的应用程序类应该如下所示:
import android.app.Application;
import com.facebook.stetho.Stetho;
public class MyApp extends Application {
@Override
public void onCreate() {
super.onCreate();
Stetho.initializeWithDefaults(this);
}
}你的名单是这样的:
<application
android:name=".MyApp"
android:allowBackup="true" />https://stackoverflow.com/questions/43440895
复制相似问题