NoClassDefFoundError的:com.parse.ParseRequest。 Android的解析异常 [英] NoClassDefFoundError: com.parse.ParseRequest. Android Parse Exception
问题描述
我必须创建一个使用 parse.com
罐子一个样本应用程序。在这个项目中打造专业化版本 SDK
22岁(这是罚款运行)。但变化后,23我对着编制应用中的一些问题。我试图清理项目,废止高速缓存。重建项目等,但我面临同样的问题的错误是:
I have create one sample app using parse.com
jar. In this project Buid version SDK
was 22(it was running fine). But after change it with 23 I am facing some issues in compiling app. I have tried to clean project, Invalidate caches. Rebuild project etc but I faced same issue error is:
FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.parse.ParseRequest
at com.parse.Parse.initialize(Parse.java:184)
我无法找到确切的解决方案。我已经检查libs文件夹有罐子。我也曾尝试用最新的 gradle这个
code,但面临着同样的错误。除去解析罐子后,我可以编译我的项目。我的依赖关系。
I can't get find exact solution. I have checked libs folder have jar. I have also tried with latest gradle
code but faced same error. After removing parse jar I can compile my project. My dependencies are
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/org.apache.http.legacy.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile project(':MaterialShowcaseView')
compile files('libs/Parse-1.9.2.jar')
compile files('libs/bolts-android-1.2.0.jar')
compile files('libs/universal-image-loader-1.9.4.jar')
}
如果我改变了依赖与
If I Change this dependencies with
compile 'com.parse.bolts:bolts-android:1.4.0'
compile 'com.parse:parse-android:1.12.0'
则错误是不同的。错误是:
then error is different. Error is:
java.lang.NoClassDefFoundError: com.parse.ParsePlugins$1
at com.parse.ParsePlugins.restClient(ParsePlugins.java:92)
at com.parse.Parse.initializeParseHttpClientsWithParseNetworkInterceptors(Parse.java:762)
at com.parse.Parse.initialize(Parse.java:365)
at com.parse.Parse.initialize(Parse.java:344)
请建议我,什么是错的这种依赖性。在此先感谢
Please suggest me, what is wrong with this dependency. Thanks in advance
推荐答案
问题不是解析class.In错误的,因为你,因为的 mulitdex 没有处理与功放;解析的动初始化是在应用程序启动时这就是为什么它会给类未找到错误。
Issue is not because of parse class.In error you get that error because of mulitdex not handled & Initilization of parse is on app start up thats why it will give class not found error.
以下行添加到的build.gradle
来处理多DEX
add below lines to build.gradle
to handle multi dex
要解决的问题是什么我给我的build.gradle
To resolve issue what i give in my build.gradle
dexOptions {
incremental true
// here heap size give 4g i got this thing from https://groups.google.com/forum/#!topic/adt-dev/P_TLBTyFWVY
javaMaxHeapSize "4g"
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
// your dependencies which you are using.
}
整个的build.gradle
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
configurations {
// all*.exclude group: 'com.android.support', module: 'recyclerview-v7'
}
android {
signingConfigs {
/*
releasebuild {
keyAlias 'hellotest'
keyPassword 'hellotest'
storeFile file('path to keystore')
storePassword 'hellotest'
}
*/
}
compileSdkVersion 'Google Inc.:Google APIs:22'
buildToolsVersion '23.0.0'
/* if you got error regarding duplicate file of META-INF/LICENSE.txt from jar file
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
*/
dexOptions {
jumboMode = true
incremental true
// here heap size give 4g i got this thing from https://groups.google.com/forum/#!topic/adt-dev/P_TLBTyFWVY
javaMaxHeapSize "4g"
}
defaultConfig {
multiDexEnabled true
applicationId "com.myapp.packagenme"
minSdkVersion 17
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.releasebuild
}
debug {
signingConfig signingConfigs.releasebuild
}
}
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
// your dependencies which you are using.
}
使用 Android开发者multidex引导MultiDexApplication类
要安装 MultiDex.install
我指 Android开发者联系
public class MyAppClass extends MultiDexApplication{
@Override
protected void attachBaseContext(Context newBase) {
MultiDex.install(newBase);
super.attachBaseContext(newBase);
}
}
的建议的
Suggestion
Selectively compiling APIs into your executable
不要使用谷歌整个播放服务的使用,才需要library.From 6.5版,而是可以选择编译谷歌播放服务API为您的应用程序。例如,只包括谷歌飞度和Android Wear的API,替换下面一行在你的build.gradle文件:
Don't use entire google play service use only required library.From version 6.5, you can instead selectively compile Google Play service APIs into your app. For example, to include only the Google Fit and Android Wear APIs, replace the following line in your build.gradle file:
compile 'com.google.android.gms:play-services:8.4.0'
这些行:
compile 'com.google.android.gms:play-services-fitness:8.4.0'
compile 'com.google.android.gms:play-services-wearable:8.4.0'
让我知道,如果任何事情。
Let me know if anything.
这篇关于NoClassDefFoundError的:com.parse.ParseRequest。 Android的解析异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!