Gradle sync完成..但抛出java.lang.ClassNotFoundException

时间:2015-10-20 15:45:53

标签: android android-studio

我想在Android Studio上添加https://github.com/aectann/socratica-android/tree/master/libraries/image-map的ImageMap库。 这是我的app/build.gradle

    apply plugin: 'com.android.application'
    repositories{
        mavenCentral()
    }
    android {
        compileSdkVersion 22
        buildToolsVersion "22.0.1"

        defaultConfig {
            applicationId "PACKAGE"
            minSdkVersion 14
            targetSdkVersion 22
            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:22.2.1'
        compile 'com.socratica.mobile:image-map:1.+@aar'
    }

它成功完成同步,并将库放在外部库中,但在尝试引用 com.socratica.mobile.ImageMap时抛出 ClassNotFoundException 布局xml文件是..

        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.socratica.mobile.ImageMap
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@drawable/usamap"
            app:map="@xml/usamap"
            app:selectionPadding="50dp"
            app:selectionColor="#f00"
            app:selectionType="stroke"
            app:selectionStrokeWidth="2"
            android:id="@+id/map"/>

    </RelativeLayout>

非常感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

我认为你必须把这一行放在build.gradle

的依赖关系上
  

编译项目(&#39;:libraries:big-image&#39;)