0

I've just restored a project from source control and my initial attempts to run it are failing. When I launch the app I get the following error

java.lang.RuntimeException: Unable to instantiate application com.mb.android.MB3Application: java.lang.ClassNotFoundException: Didn't find class "com.mb.android.MB3Application" on path: DexPathList[[zip file "/data/app/com.mb.android-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.mb.android-1, /vendor/lib, /system/lib]]

This project was working prior to an OS re-install.

An excerpt from my manifest.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mb.android"
android:versionCode="9"
android:versionName="1.0.8" >

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="19" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme"
    android:name=".MB3Application" >

    <meta-data
        android:name="android.app.default_searchable"
        android:value="com.mb.android.activities.mobile.SearchResultsActivity"/>

    <activity
        android:name=".activities.MainActivity"
        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>

...
removed
...

</application>

</manifest>

The package declaration in MB3Application.java

package com.mb.android;


public class MB3Application extends Application implements MediaPlayer.OnCompletionListener {
}

The package declaration in MainActivity.java

package com.mb.android.activities;


public class MainActivity extends BaseMB3Activity implements ServerLocatedListener {
}

From what I can tell everything is ok. Does anyone have any ideas where this ClassNotFoundException is coming from. Also, the project is being built using Android Studio.

Thanks.

EDIT: In response to an answer below. Here are how my libraries are set up.

I only have one module in the project. Here are it's libs. I've right-clicked on them and selected add as library where possible.

enter image description here

The external libraries section of the project.

enter image description here

The modules build.gradle dependencies

enter image description here

The dependencies listed in the project structure dialog

enter image description here

Redshirt
  • 664
  • 7
  • 25

1 Answers1

0

Basically a Java Build Path issue:

  • Check that you are not missing that .jar file from your 'libs' folder.
  • Check the project build path.
  • Check that library requiring being exported are exported.

Android Studio - Importing external Library/Jar

Community
  • 1
  • 1
Rastikan
  • 517
  • 5
  • 18
  • Thanks for the reply. I'm still not able to resolve this with that info. I've updated my original post with images. Hopefully you or someone else can elaborate. – Redshirt Dec 14 '13 at 22:46
  • It was a library that wasn't added properly. Thanks – Redshirt Dec 15 '13 at 00:42