java.lang.NoClassDefFoundError的错误,当我尝试实例化的GCS服务 [英] java.lang.NoClassDefFoundError error when I try to instantiate the GCS Service

查看:150
本文介绍了java.lang.NoClassDefFoundError的错误,当我尝试实例化的GCS服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很新的的Java / Android开发。我选择的IDE的是Android工作室。基本上我需要的图像/ vidoes剪辑和音频剪辑上传到GCS。我实例化服务,像这样

I am very new to java/Android development. My IDE of choice is Android Studio. Essentially I need to upload images/vidoes clips and audio clips to GCS. I am instantiating the service like this

最终GcsService gcsService => GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance());

  当我运行应用程序我碰到下面的错误

  java.lang.NoClassDefFoundError的:com.google.appengine.api.utils.SystemProperty
             在>com.google.appengine.tools.cloudstorage.GcsServiceFactory.createRawGcsService(GcsServiceFact>ory.java:40)
             在>com.google.appengine.tools.cloudstorage.GcsServiceFactory.createGcsService(GcsServiceFactory>.java:34)
             在> com.horcu.lme.gavi.cloud.CloudPersister.downloadDataFromGcs(CloudPersister.java:30)
             在> com.horcu.lme.gavi.MainActivity $ PlaceholderFragment.onCreateView(MainActivity.java:159)
  

  我的build.gradle文件的相关性部分看起来像这样

" final GcsService gcsService = >GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance());"
When I run the app I get the following error
java.lang.NoClassDefFoundError: com.google.appengine.api.utils.SystemProperty at >com.google.appengine.tools.cloudstorage.GcsServiceFactory.createRawGcsService(GcsServiceFact>ory.java:40) at >com.google.appengine.tools.cloudstorage.GcsServiceFactory.createGcsService(GcsServiceFactory>.java:34) at >com.horcu.lme.gavi.cloud.CloudPersister.downloadDataFromGcs(CloudPersister.java:30) at >com.horcu.lme.gavi.MainActivity$PlaceholderFragment.onCreateView(MainActivity.java:159)
The dependency section of my build.gradle file looks like this

依赖性{
     编译com.android.support:support-v4:19.0.1
     编译com.android.support:appcompat-v7:19.0.1
    编译文件树(导演:'库',包括:['的* .jar'])
     编译com.google.guava:番石榴集合:R03 @罐子
    编译com.google.appengine.tools:appengine-gcs-client:0.3.3@jar
     编译公地IO:公地IO:20030203.000550@jar

dependencies { compile 'com.android.support:support-v4:19.0.1' compile 'com.android.support:appcompat-v7:19.0.1' compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.guava:guava-collections:r03@jar' compile 'com.google.appengine.tools:appengine-gcs-client:0.3.3@jar' compile 'commons-io:commons-io:20030203.000550@jar'

}

正如你可以看到我,包括AppEngine上-GCS-客户端jar文件,并将它编译得很好,但在运行时崩溃。
任何人都可以提出此修复?

As you can see I am including the appengine-gcs-client jar file and it compiles just fine but crashes at run-time. Can anyone suggest a fix for this?

推荐答案

这通常意味着你缺少的依赖关系。需要注意的是GCS需要更多的则只是AppEngine上-GCS-客户端jar。首先,我认为,这需要乔达-time.jar。

This usually means that you are missing dependencies. Note that GCS requires more then just the appengine-gcs-client jar. For one thing, I think it requires joda-time.jar.

此外,使用API​​的是不能作为应用程序引擎中的服务通常需要谷歌的Java客户端库,你有吗?结果
的https://$c$c.google.com/p/谷歌的API-Java的客户端/

Also, using the API's that are not available as services within app engine typically requires the Google Java client library, do you have that?
https://code.google.com/p/google-api-java-client/

最后,我想指出,你有上面的错误是com.google.appengine.api.utils.SystemProperty,这实际上是应用程序引擎本身的一部分。你有没有在App Engine JAR的?我没有用过Android的工作室,但我不会指望你必须添加应用程序引擎JAR的手动 - 当你创建应该已经自动添加一个App Engine项目

Finally, I would note that the error you have above is for "com.google.appengine.api.utils.SystemProperty" which is actually part of app engine itself. Do you have the app engine JAR's? I haven't used Android Studio but I wouldn't expect you to have to add the app engine JAR's manually - when you created an app engine project that should have been added automatically.

如果你没有结婚到Android工作室,你可能要考虑的Eclipse ADT +,所有这些都是为你做。谷歌曾表示,Android的工作室将支持GAE,但它甚至没有发布针对Android还没有,更不用说应用程序引擎。

If you aren't wed to Android Studio, you might want to consider Eclipse + ADT where all of this is done for you. Google has said that Android STudio will support GAE, but it's not even released for Android yet, let alone app engine.

这篇关于java.lang.NoClassDefFoundError的错误,当我尝试实例化的GCS服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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