当我添加Youtube Player API jar文件(1.2.1或1.2.2 - 未测试旧版)时,似乎JVM在运行时找不到我的大多数类。
例如,当我添加JAR文件时,抛出此错误:
...
Caused by: java.lang.ClassNotFoundException: com.estudiotrilha.view.PatchedScrollingViewBehavior
...
如果我停止使用此类,则会抛出此错误:
...
Caused by: java.lang.NoClassDefFoundError: com.estudiotrilha.inevent.R$styleable
...
我怀疑当我添加JAR文件时,由于某种原因,对某些类的引用会消失(可能是因为空间不足?)。我只是猜测,但项目确实非常庞大,我已经在使用multidex。
PS:当我删除JAR文件时,一切正常。
另外,我甚至没有使用该库,只是将jar文件添加到我的libs文件夹并在我的应用程序中编译它,它就会中断。
这是我的 build.gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion sdkVersion
buildToolsVersion btVersion
defaultConfig {
applicationId "com.estudiotrilha.inevent"
minSdkVersion 14
targetSdkVersion 22
versionCode 101
versionName "3.1.5p3"
multiDexEnabled true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
}
signingConfigs {
release {
/* hidden */
}
}
buildTypes {
debug {
}
release {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
whiteLabelFlavor {
applicationId "us.inevent.apps.whiteLabel"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':libraries:view-pager-indicator')
compile project(':libraries:CropImage')
// ExtendView library
compile 'com.mauriciogiordano:extendview:1.0.2'
// Design support libraries (Google)
compile androidSupport.appcompat
compile androidSupport.cardview
compile androidSupport.gridlayout
compile androidSupport.recyclerview
compile androidSupport.design
// Design support libraries (third-party)
compile 'com.cocosw:bottomsheet:1.+@aar'
compile 'com.rengwuxian.materialedittext:library:1.8.3'
compile 'com.pnikosis:materialish-progress:1.7'
// RecyclerView animators :)
compile 'jp.wasabeef:recyclerview-animators:1.3.0'
compile 'com.facebook.android:facebook-android-sdk:3.23.1'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.github.castorflex.smoothprogressbar:library:1.0.0'
compile 'com.mixpanel.android:mixpanel-android:4.5.3'
compile 'com.android.support:multidex:1.0.0'
compile (httpcomponents.mime) {
exclude module: 'httpclient'
}
compile httpcomponents.client
}
task appStart(type: Exec, dependsOn: 'installWhiteLabelFlavorDebug') {
// linux
commandLine 'osascript', '-e', 'display notification "Your manual build has finished!" with title "Build completed"'
}
答案 0 :(得分:0)
清理整个构建文件夹修复了问题......