抛出java.lang.ClassNotFoundException:没有找到路径类:dexpathlist没有找到、抛出、路径、java

2023-09-12 03:28:36 作者:我要无比强大

我目前工作的一个项目中,我必须使用纯天然NDK。当我尝试运行从Irrlicht的引擎源的HelloWorld示例,它的工作。然后我尝试下面的这个例子的格式相同使用它在我的项目。但我得到了:

I'm currently working on a project in which I have to use purely native ndk. It worked when I try running an helloworld example from Irrlicht engine source. Then I try using it in my project following the same format of that example. But I got:

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]]

在运行我的项目。

while running my project.

下面是我的main.cpp文件:

Here is my main.cpp file:

#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

#endif

在Android.mk:

in 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.xml中给出活动名称:

And I have given Activity name in AndroidManifest.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" />                     

什么是错误的,我在这里做什么?我会发布完整的code如果necassary。

What is the mistake I am doing here? I'll post full code if necassary.

推荐答案

我也有类似的问题,这是我的解决办法:

I had a similar problem, here's my solution:

右键点击您的项目,并选择属性 选择 Java构建路径从左边的菜单。 选择订单和出口标签。 从列表中一定要添加到您的项目库或外部罐子的检查的 最后,清理项目和放大器;运行。 Right click on your project and select Properties. Select Java Build Path from the menu on the left. Select the Order and Export tab. From the list make sure the libraries or external jars you added to your project are checked. Finally, clean your project & run.

您也可以检查this的回答。

 
精彩推荐
图片推荐