我看到了很多类似于这个问题的问题,但它们似乎是针对它们使用的类和包具体而言的。我尝试了一些解决方案,但没有帮助到我。我遇到了以下错误:
03-27 14:30:08.604: D/AndroidRuntime(8057): Shutting down VM
03-27 14:30:08.604: W/dalvikvm(8057): threadid=1: thread exiting with uncaught exception (group=0x41c02c80)
03-27 14:30:08.604: E/AndroidRuntime(8057): FATAL EXCEPTION: main
03-27 14:30:08.604: E/AndroidRuntime(8057): Process: org.nick.nfc.seaccess, PID: 8057
03-27 14:30:08.604: E/AndroidRuntime(8057): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.nick.nfc.seaccess/org.nick.nfc.seaccess.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "org.nick.nfc.seaccess.MainActivity" on path: DexPathList[[zip file "/system/framework/com.android.nfc_extras.jar", zip file
任何想法,我应该如何解决它?
这是主要活动的开始:
public class MainActivity extends Activity implements OnClickListener {
private static final String TAG = MainActivity.class.getSimpleName();
private Button gpInfoButton;
private Button emvInfoButton;
private Button walletInfoButton;
private TextView infoText;
private Terminal terminal;
private CardConnection seConn;
@Override
public void onCreate(Bundle savedInstanceState) {
...
这是我从清单文件中提取的活动标签。有时候人们会在清单文件中添加完整的包名。我应该这样做并查看发生了什么吗?
<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|s mallestScreenSize"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
我发现一个链接说问题可能出在我编辑的一个包含证书的xml文件上。我已经粘贴了下面的文件,删除了证书。你看到有什么问题吗?
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Applications granted NFCEE access on user builds
See packages/apps/Nfc/etc/sample_nfcee_access.xml for full documentation.
-->
<!-- Google wallet release signature -->
<signer android:signature="308205bd852e" />
<!-- Sequent Wallet signature -->
<signer android:signature="30820243badc1df9d"/>
<!-- android-se-access signature-->
<signer
android:signature="3082044cbd852e">
<package android:name="org.nic.nfc.seaccess"/>
</signer>
</resources>
这是项目工作区的视图
我在日志中看到了一些东西,想要添加到这个帖子中。似乎包名旁边有“-1”和“-2”。那应该在那里,还是它引起了我的问题?这是我所说的日志消息:
03-27 22:55:10.884: E/AndroidRuntime(9436): Caused by: java.lang.ClassNotFoundException: Didn't find class "org.nick.nfc.seaccess.MainActivity" on path: DexPathList[[zip file "/system/framework /com.android.nfc_extras.jar", zip file "/data/app/org.nick.nfc.seaccess- 1.apk"],nativeLibraryDirectories=[/data/app-lib/org.nick.nfc.seaccess-1, /vendor/lib, /system/lib]]
03-27 22:58:02.104: E/AndroidRuntime(9880): Caused by: java.lang.ClassNotFoundException: Didn't find class "org.nick.nfc.seaccess.MainActivity" on path: DexPathList[[zip file "/system/framework /com.android.nfc_extras.jar", zip file "/data/app/org.nick.nfc.seaccess- 2.apk"],nativeLibraryDirectories=[/data/app-lib/org.nick.nfc.seaccess-2, /vendor/lib, /system/lib]]
MainActivity
类放在了除了org.nick.nfc.seaccess
以外的包中? - Michael Rolandcom.android.nfc_extras.jar
,那应该不会有问题。在那些其他项目中使用了哪些包名? - Michael Roland