java.lang.ClassNotFoundException: Didn't find class on path: dexpathlist
2022-08-31 06:48:14
我目前正在处理一个项目,其中我必须使用纯本机ndk。当我尝试从Irrlicht引擎源代码运行helloworld示例时,它起作用了。然后,我尝试按照该示例的相同格式在我的项目中使用它。但我得到了:
03-14 01:40:05.308: E/AndroidRuntime(799): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.irrlicht.example1/android.app.POMActivity}: java.lang.ClassNotFoundException: Didn't find class "android.app.POMActivity" on path: DexPathList[[zip file "/data/app/com.irrlicht.example1-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.irrlicht.example1-2, /system/lib]]
在运行我的项目时。
这是我的主要.cpp文件:
#include <android/log.h>
#include <jni.h>
#include <android_native_app_glue.h>
#include "android_tools.h"
#ifdef _IRR_ANDROID_PLATFORM_
void android_main(android_app* app)
{
__android_log_print(4 , "pom" , "nothing");
}
#endif
在 Android.mk:
LOCAL_PATH := $(call my-dir)/..
IRRLICHT_PROJECT_PATH := $(LOCAL_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := Irrlicht
LOCAL_SRC_FILES := /home/karthik/Android/Essentials/ogl-es/lib/Android/libIrrlicht.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := HelloWorldMobile1
LOCAL_CFLAGS := -D_IRR_ANDROID_PLATFORM_ -pipe -fno-exceptions -fno-rtti -fstrict-aliasing
LOCAL_C_INCLUDES := -I ../../include -I /home/karthik/Android/Essentials/ogl-es/include -I /home/karthik/Android/json/jsoncpp-src-0.5.0/libs/linux-gcc-4.8 -I /home/karthik/Android/json/jsoncpp-src-0.5.0/include/json
LOCAL_SRC_FILES := android_tools.cpp main.cpp
LOCAL_LDLIBS := -lEGL -llog -lGLESv1_CM -lGLESv2 -lz -landroid -ldl
LOCAL_STATIC_LIBRARIES := Irrlicht android_native_app_glue
include $(BUILD_SHARED_LIBRARY)
$(call import-module,android/native_app_glue)
我在 AndroidManifest 中给出了 Activity name.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.irrlicht.example1"
android:versionCode="1"
android:versionName="1.0">
...
<application android:icon="@drawable/irr_icon" android:label="HelloWorldMobile1" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:debuggable="true">
<activity android:name="android.app.POMActivity"
android:label="HelloWorldMobile1"
android:launchMode="singleTask"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait"
android:clearTaskOnLaunch="true">
<meta-data android:name="android.app.lib_name" android:value="HelloWorldMobile1" />
我在这里犯了什么错误?如有必要,我会发布完整的代码。