0

I have a project that I'm trying to run but I want to run it against Google API's 21 so that I can use MapActivity and basically implement this maps solution

I added the code and to get it working without errors I had to add compileSdkVersion to "Google Inc.:Google APIs:21".

Every time I launch, the app crashes on launch with this exception:

Suppressed: java.lang.ClassNotFoundException: com.syncworks.syncmap.Main
            at java.lang.Class.classForName(Native Method)
            at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
            at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
            ... 13 more
     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

I cannot seem to solve it. I've tried cleaning the project, rebuilding. Changing the compileSdkVersion to 21 prevents me from using the classes in the linked solution. I have Google API's installed from the SDK manager and the Google Play Services library is working cause I was able to launch the app fine just before trying to implement the linked solution.

I read answers about checking whether Android Private Libraries were included but I didn't know how I could access and check that from Android Studio

below is my app's build.gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion "Google Inc.:Google APIs:21"
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.syncworks.syncmap"
        minSdkVersion 21
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.google.android.gms:play-services:6.5.87'
}

And here's my manifest:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.syncworks.syncmap" >

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <uses-library android:name="com.google.android.maps"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="@string/google_maps_key" />

        <activity
            android:name=".Main"
            android:label="@string/title_activity_maps" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Any help please?

Community
  • 1
  • 1
Odaym
  • 1,896
  • 1
  • 20
  • 31
  • doesnt compile because of compileSdkVersion "Google Inc.:Google APIs:21" change this to "21.0.0" ? – Kurdish Droid Feb 21 '15 at 14:27
  • it does compile as I mentioned, and the only reason I was able to use the classes in the linked solution was because of that value. The thing is that it crashes upon start with NoClassDef on my Main Activity which definitely does exist. – Odaym Feb 21 '15 at 14:31
  • can you add your manifest above? – Kurdish Droid Feb 21 '15 at 14:31
  • Did you check the libraries and jar you have added in Order & Export Section ? – Muhammad Ashraf Feb 21 '15 at 14:35
  • I'm using Android Studio, I couldn't figure out where to access those but I have definitely read answers that say that and say to check Java Build Path to ensure Android Private Libraries exist. Dont know where to check those.. – Odaym Feb 21 '15 at 14:36

1 Answers1

0

The logcat shows that problem is in your MainActivity.java class instead of build.gradle or Manifest file. If you can post your MainActivity.java file it will help to evaluate the cause of this issue further!!

Thanks1!

AniV
  • 3,997
  • 1
  • 12
  • 17