我已经在多个堆栈溢出问题以及其他站点中广泛地搜索了这个错误,但是我得到的日志消息与我以前看到的略有不同。
不同之处在于:
12-05 10:45:11.111: E/AndroidRuntime(2643):致命例外:主12-05 10:45:11.111: E/AndroidRuntime(2643):java.lang.RuntimeException:无法实例化活动ComponentInfo {com.example.myapp/com.example.myapps.plash}:java.lang.ClassNotFoundException:没有在路径上找到类"com.example.myapp.Splash“:DexPathList[ ".",nativeLibraryDirectories=/system/lib]
我看到的所有其他问题在DexPathlist中通常都有一些apk路径,但在我的例子中,什么都没有。
清单的相关部分是:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" android:hasCode="false" android:requiredForAllUsers="true">
<activity
android:name=".Splash"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
...
我尝试过其他问题上的所有建议(例如,启用Order选项卡下的Android专用库和Android依赖项、清洁和重建项目),但似乎没有任何效果!我甚至创建了一个新项目,并复制了所有的东西,但在新项目中我仍然遇到同样的问题。
最令人困惑的是,这种情况是自发发生的。一段时间后,我又回到了这个项目,并在添加了一个新的图像以用于我的启动屏幕后运行了它。我想到的唯一一件事是,当我最初上传一张图片时,它被命名为“sr-spash.jpg”,因为它的破折号被拒绝了。因此,我将其重构/重命名为"sr_splash.jpg“并进行了更新。在这一次更改之后,我立即运行了该项目,并开始遇到这个问题,但似乎不太可能有任何部分与错误有关,但我认为我会提到它。
提前感谢!
发布于 2015-12-05 20:42:56
拿到了..。这句话是:
android:theme="@style/AppTheme" android:hasCode="false" android:requiredForAllUsers="true">
我把
android:hasCode="false"
它开始正常运行。
https://stackoverflow.com/questions/34108146
复制相似问题