Youtube播放器API导致java.lang.NoClassDefFoundError
当我添加Youtube播放器API jar文件(1.2.1或1.2.2-未测试旧版本)时,JVM似乎无法在运行时找到我的大多数类 例如,当我添加JAR文件时,会抛出以下错误:Youtube播放器API导致java.lang.NoClassDefFoundError,java,android,gradle,jar,youtube,Java,Android,Gradle,Jar,Youtube,当我添加Youtube播放器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.estud
...
Caused by: java.lang.ClassNotFoundException: com.estudiotrilha.view.PatchedScrollingViewBehavior
...
...
Caused by: java.lang.NoClassDefFoundError: com.estudiotrilha.inevent.R$styleable
...
如果停止使用此类,将引发以下错误:
...
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"'
}
清理整个生成文件夹修复了问题…清理整个生成文件夹修复了问题…这些缺少的类是直接属于您的项目还是来自依赖项?直接属于我的项目,相同的包。。。实际上它在同一个文件中。。。一个类没有从同一个文件中找到一个内部类。嗯,我想这是android特有的,我在java应用程序中从未见过这种情况。这些缺少的类是直接属于您的项目还是来自依赖项?直接属于我的项目,同一个包。。。实际上它在同一个文件中。。。一个类并不是从同一个文件中找到一个内部类。我想这是android特有的,我在java应用程序中从未见过这样的事情