我正在写一个Xposed模块(运行),我刚刚添加了一个活动,所以我可以在应用程序中调整一些设置。
我以常规Android方式创建了一个Activity,并将其添加到我的清单(包名称正确)。我还将类名添加到我的xposed_init文件中。
我仍然在我的logcat中得到这个:
07-02 15:50:33.275: E/AndroidRuntime(2505): Caused by: java.lang.ClassNotFoundException: Didn't find class "tweaks.vinit.xdictionary.DictSettings" on path: DexPathList[[zip file "/data/data/de.robv.android.xposed.installer/bin/XposedBridge.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
问题是什么?
编辑:这是一个更详细的日志。
07-02 18:33:25.485: W/Xposed(16780): Package name for /data/app/com.zst.xposed.xuimod-1.apk had to be retrieved via parser
07-02 18:33:25.489: W/ActivityThread(16780): Application tweaks.vinit.xdictionary can be debugged on port 8100...
07-02 18:33:25.491: D/AndroidRuntime(16780): Shutting down VM
07-02 18:33:25.491: W/dalvikvm(16780): threadid=1: thread exiting with uncaught exception (group=0x41632d40)
07-02 18:33:25.493: E/AndroidRuntime(16780): FATAL EXCEPTION: main
07-02 18:33:25.493: E/AndroidRuntime(16780): Process: tweaks.vinit.xdictionary, PID: 16780
07-02 18:33:25.493: E/AndroidRuntime(16780): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{tweaks.vinit.xdictionary/tweaks.vinit.xdictionary.TempClass}: java.lang.ClassNotFoundException: Didn't find class "tweaks.vinit.xdictionary.TempClass" on path: DexPathList[[zip file "/data/data/de.robv.android.xposed.installer/bin/XposedBridge.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
07-02 18:33:25.493: E/AndroidRuntime(16780): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2135)
07-02 18:33:25.493: E/AndroidRuntime(16780): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
07-02 18:33:25.493: E/AndroidRuntime(16780): at android.app.ActivityThread.access$800(ActivityThread.java:139)
07-02 18:33:25.493: E/AndroidRuntime(16780): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
07-02 18:33:25.493: E/AndroidRuntime(16780): at android.os.Handler.dispatchMessage(Handler.java:102)
07-02 18:33:25.493: E/AndroidRuntime(16780): at android.os.Looper.loop(Looper.java:136)
07-02 18:33:25.493: E/AndroidRuntime(16780): at android.app.ActivityThread.main(ActivityThread.java:5102)
07-02 18:33:25.493: E/AndroidRuntime(16780): at java.lang.reflect.Method.invokeNative(Native Method)
07-02 18:33:25.493: E/AndroidRuntime(16780): at java.lang.reflect.Method.invoke(Method.java:515)
07-02 18:33:25.493: E/AndroidRuntime(16780): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
07-02 18:33:25.493: E/AndroidRuntime(16780): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
07-02 18:33:25.493: E/AndroidRuntime(16780): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
07-02 18:33:25.493: E/AndroidRuntime(16780): at dalvik.system.NativeStart.main(Native Method)
07-02 18:33:25.493: E/AndroidRuntime(16780): Caused by: java.lang.ClassNotFoundException: Didn't find class "tweaks.vinit.xdictionary.TempClass" on path: DexPathList[[zip file "/data/data/de.robv.android.xposed.installer/bin/XposedBridge.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
07-02 18:33:25.493: E/AndroidRuntime(16780): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
07-02 18:33:25.493: E/AndroidRuntime(16780): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
07-02 18:33:25.493: E/AndroidRuntime(16780): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
07-02 18:33:25.493: E/AndroidRuntime(16780): at android.app.Instrumentation.newActivity(Instrumentation.java:1084)
07-02 18:33:25.493: E/AndroidRuntime(16780): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2126)
07-02 18:33:25.493: E/AndroidRuntime(16780): ... 12 more
编辑2:同样,TempClas(第二个日志)与DictSettings(第一个日志)相同,只是一个不同的名称。这是代码:
package tweaks.vinit.xdictionary;
import android.app.Activity;
import android.os.Bundle;
public class TempClass extends Activity {
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.templayout);
}
}
编辑3:aaand,这是我的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tweaks.vinit.xdictionary"
android:versionCode="1"
android:versionName="0.9.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:hasCode="false"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="tweaks.vinit.xdictionary.TempClass"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="xposedmodule"
android:value="true" />
<meta-data
android:name="xposeddescription"
android:value="App that searches for the definition of your selection on dictionary.com" />
<meta-data
android:name="xposedminversion"
android:value="30" />
</application>
</manifest>
答案 0 :(得分:1)
如果DictSettings
使用任何特定于Xposed的内容,则在Activity
中使用它将无效,因为Xposed类仅在APK的模块部分中可用,而不是'普通应用'部分!
如果仔细查看logcat
,您可能会发现dalvikvm
抱怨错过基类DictSettings
,然后导致ClassNotFoundException
!
编辑:您为什么使用hasCode=false
?尝试将其更改为true
!