Reputation: 13
I am creating a simple Android app that would take a picture and upload it to Google cloud storage. The simplest (and recommended) way is to use the provided client library.
But even the empty AndroidStudio with dependency to gcs fails to run. It compiles, but fails to run with the failures:
WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages.
Error:Execution failed for task ':app:preDexDebug'.
com.android.ide.common.internal.LoggedErrorException:
Failed to run command: /home/milan/AndroidStudioSdk/sdk/build-tools/21.1.1/dx --dex --output /home/milan/AndroidStudioProjects/Test/app/build/intermediates/pre-dexed/debug/transaction-api-1.1-d542431644c5559f18a80700bbbf3a2bc4472ff7.jar /home/milan/.gradle/caches/modules-2/files-2.1/javax.transaction/transaction-api/1.1/2ca09f0b36ca7d71b762e14ea2ff09d5eac57558/transaction-api-1.1.jar
Error Code: 1
Output: trouble processing "javax/transaction/HeuristicCommitException.class": Ill-advised or mistaken usage of a core class (java.* or javax.*) when not building a core library...........
I am using AndroidStudio 0.8.14 on Kubuntu 14.10 with java-7-jdk-oracle (1.7.0_72-b14).
I have read and tried everything from stackoverflow / web I could find: invalidating cache, cleaning up the project, compile the library from sources, even reinstall of the OS. Nothing worked so far. preDex failed in all cases.
build.gradle:
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 21
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.appengine.tools:appengine-gcs-client:0.4.3'
}
Is there anyone who can create default AndroidStudio 0.8.14 project with project dependency to google cloud services and is able to RUN the application? Your build.gradle would help a lot. I am probably missing something obvious.
Upvotes: 1
Views: 461
Reputation: 547
The library you are using is intended to be used as a client on Google App Engine, not on Android.
Take a look at this page for the Java client library for Google Cloud Storage: https://developers.google.com/api-client-library/java/apis/storage/v1
The dependency you need is:
compile 'com.google.apis:google-api-services-storage:v1-rev22-1.19.0'
Upvotes: 2