我似乎遇到了与无数社区类似的问题;不过,我似乎没有相同的症状(或者至少我的Google-fu不允许我找到它)。MainActivity NoClassDefFoundError
长话短说:应用程序给我java.lang.RuntimeException: Unable to instantiate activity
。
根据我的理解,这只能由不正确的加载库顺序或在AndroidManifest.xml中丢失文件引起。
这里是我的AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.alexanderlyons.livingpokedex">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Here is a link to my repository for those wanting to build it themselves.如果谁能给我的见解,什么可能是错误的。
注:这可能是由于我的.gitignore,因为我最后一次建造,它在我的主塔。我只在远程计算机上遇到此问题。
TL:DR - 我的MainActivity未加载,它存在于AndriodManifest.xml中,我只使用阶梯加载文件,而不是本地jar。
这并没有解决我的问题。我目前只使用我认为是几个图书馆的东西。 [这是我的应用程序build.gradle](https://github.com/alyons/Living-Pokedex/blob/master/Andriod/LivingPokedex/app/build.gradle);它看起来好像我加载了太多的库? –
你应该尝试这个解决方法,我的一个朋友用来发现问题: 用构建工具22,sd版本22和目标22测试项目。另外,使用支持库22. + – W0MP3R