我是Android和Eclipse的新手,我正试图找出我的Android项目可能出现的问题。两天前它工作正常,装在手机上,一切都很开心。如果没有我(除了清洁和重建)以外的其他任何事情,我现在收到以下通知:
09-29 11:19:45.148: W/System(16536): ClassLoader referenced unknown path: /data/app/com.example.blephello-2/lib/arm64
导致以下错误:
09-29 10:51:35.343: E/AndroidRuntime(15470): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.example.blephello.BlepHello: make sure class name exists, is public, and has an empty constructor that is public
09-29 10:51:35.343: E/AndroidRuntime(15470): at android.app.Fragment.instantiate(Fragment.java:620)
09-29 10:51:35.343: E/AndroidRuntime(15470): at android.app.Fragment.instantiate(Fragment.java:584)
09-29 10:51:35.343: E/AndroidRuntime(15470): at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2192)
09-29 10:51:35.343: E/AndroidRuntime(15470): at android.app.FragmentController.onCreateView(FragmentController.java:98)
09-29 10:51:35.343: E/AndroidRuntime(15470): at android.app.Activity.onCreateView(Activity.java:5559)
09-29 10:51:35.343: E/AndroidRuntime(15470): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:754)
09-29 10:51:35.343: E/AndroidRuntime(15470): ... 21 more
09-29 10:51:35.343: E/AndroidRuntime(15470): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.blephello.BlepHello" on path: DexPathList[[zip file "/data/app/com.example.blephello-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.blephello-2/lib/arm64, /vendor/lib64, /system/lib64]]
为了好玩,我看过this this this this this以及其他一些与gradle设置相关的问题,没有任何效果然而。无论如何,当我看到我的班级和期望的时候,例如com.example.blephello.BlepHello一切都很好看:
package com.example.blephello;
import java.util.ArrayList;
import java.util.UUID;
import processing.core.PApplet;
import processing.core.PFont;
import blepdroid.Blepdroid;
import blepdroid.BlepdroidDevice;
public class BlepHello extends PApplet {
BlepdroidDevice test;
PFont fontA;
ArrayList<String> results;
boolean allSetUp = false;
public BlepHello()
{
}
我有片段所需的空构造函数。当我查看我的dex字节码时,我看到那里列出的类:
Class #817 -
Class descriptor : 'Lcom/example/blephello/BlepHello;'
Access flags : 0x0001 (PUBLIC)
Superclass : 'Lprocessing/core/PApplet;'
Interfaces -
Static fields -
Instance fields -
#0 : (in Lcom/example/blephello/BlepHello;)
name : 'allSetUp'
type : 'Z'
access : 0x0000 ()
#1 : (in Lcom/example/blephello/BlepHello;)
name : 'fontA'
type : 'Lprocessing/core/PFont;'
access : 0x0000 ()
#2 : (in Lcom/example/blephello/BlepHello;)
name : 'results'
type : 'Ljava/util/ArrayList;'
access : 0x0000 ()
#3 : (in Lcom/example/blephello/BlepHello;)
name : 'test'
type : 'Lblepdroid/BlepdroidDevice;'
access : 0x0000 ()
Direct methods -
#0 : (in Lcom/example/blephello/BlepHello;)
name : '<init>'
type : '()V'
access : 0x10001 (PUBLIC CONSTRUCTOR)
code -
registers : 2
ins : 1
outs : 1
insns size : 7 16-bit code units
catches : (none)
positions :
0x0000 line=39
0x0003 line=37
0x0006 line=42
locals :
0x0000 - 0x0007 reg=1 this Lcom/example/blephello/BlepHello;
所以它就在那里,只是不被某种方式捡起来?我确实在Properties-&gt; Java Build Path-&gt; Order and Export中导出了类。我已经完全卸载了应用程序而没有更好的结果。该活动在Manifest中正确声明(我认为):
<activity
android:name=".FullscreenActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:theme="@style/FullscreenTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
活动本身很简单:
package com.example.blephello;
import com.example.blephello.util.SystemUiHider;
//import android.R;
import android.annotation.TargetApi;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.MotionEvent;
import android.view.View;
public class FullscreenActivity extends Activity {
但是当我运行Android Lint时,我会看到以下内容:
Class referenced in the manifest, com.example.blephello.FullscreenActivity, was not found in the project or the libraries AndroidManifest.xml
这让我觉得某些东西缺少我的类文件,我只是不确定它是什么。任何关于项目/路径/编译设置的指针都会非常感激。