异常java.lang.NoClassDefFoundError的:com.google.android.gms.common.AccountPicker [英] Exception java.lang.NoClassDefFoundError: com.google.android.gms.common.AccountPicker

查看:353
本文介绍了异常java.lang.NoClassDefFoundError的:com.google.android.gms.common.AccountPicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在快速入门:运行驱动器应用程序从谷歌推动Android SDK。我按照孔的过程,但是当我跑在我的设备(以假乱真)的应用程序,它具有以下异常崩溃:

I'm trying the Quickstart: Run a Drive App on Android from Google Drive SDK. I have followed the hole process, but when I ran the app in my devices (real ones), it crashes with the following exception:

java.lang.NoClassDefFoundError: com.google.android.gms.common.AccountPicker

最后,它指出了我在这个code中的第二行源:

And finally, it points to my source in the second line of this code:

credential = GoogleAccountCredential.usingOAuth2(this, DriveScopes.DRIVE);
startActivityForResult(credential.newChooseAccountIntent(), REQUEST_ACCOUNT_PICKER); // <- This one

我的confussion来自一个事实,我所做的一切文章指示我做的:

My confussion comes from the fact I have done everything the article instructs me to do:

  • 我在生成证书

  • I have generated the certificate

已启用的API(与证书指纹)

Enabled the API (with the certificate fingerprint)

创建和可配置的Andr​​oid项目在Eclipse

Created and configurated the android project in Eclipse

  • 加入了谷歌插件API的

复制的范例(其实我复制粘贴)

Copied the sample (I actually did copy-paste)

  • Ofcourse,我纠正了包和类名

  • Ofcourse, I corrected the package and class names

此外,我添加了权限的应用程序,甚至其他的权限来的定做acounts

Also I added the permissions for the App, even other permissions reffering to acounts

我还添加了谷歌Android的游戏开发者API 及其perimssions。

I even added the Google Play Android Developer API and its perimssions.

但是当我运行的应用程序,它仍然崩溃。所有的库似乎是罚款。我不知道它是具体到Android APIv17,因为我的设备是APIv10和APIv15(我加了支持库也)。

But when I run the App, it still crashes. All the libraries seem to be fine. I wonder if it is specific to Android APIv17, since my devices are APIv10 and APIv15 (I added the support library also).

请,帮助。而原谅我的英语不好。谢谢你。

Please, help. And excuse me for my bad english. Thank you.

推荐答案

我与jtwitter.jar库同样的问题。如果你运行的是Android工作室,你必须做一个干净的&放大器;建设(其中AS不真正做对了)。

I had the same issue with the jtwitter.jar library. If you're running Android Studio, you have to do a clean & build (which AS doesn't truly do right now).

转到您的命令行,导航到你的项目的根和执行 ./ gradlew干净

Go to your command line, navigate to your project root and execute ./gradlew clean

你这样做之前

请确保您的.jar文件添加到您的 /库文件夹(如果您使用的是建立17或更高版本,它必须是,而不是 LIB )。右键单击并选择的添加为图书馆...

Ensure that your .jar file is added to your /libs folder (if you're using build 17 or later, it has to be libs, and not lib). Right-click and select Add as Library...

然后你将不得不编辑您的build.gradle文件(位于 / src目录目录)。

Then you're going to have to edit your build.gradle file (located in your /src directory).

这应该是这个样子:

buildscript {
    repositories {
        maven { url 'http://repo1.maven.org/maven2' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.4'
    }
}
apply plugin: 'android'

dependencies {
    compile files('libs/android-support-v4.jar')
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 5
        targetSdkVersion 16
    }
}

更改依赖块看起来是这样的:

Change the dependencies block to look like this:

dependencies {
    compile files('libs/android-support-v4.jar')
    compile files('[path/to/.jar]')
}

然后就可以生成并运行您的项目。

Then you can build and run your project.

这篇关于异常java.lang.NoClassDefFoundError的:com.google.android.gms.common.AccountPicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆