jainshravan123 / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

Cannot able Run Android application #901

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Version of google-api-java-client (e.g. 1.19.0)?

Java environment (e.g. Java 6, Android 3.0+ , App Engine)?

I want to use Google Play Developer API to verify the android subscription.

https://www.googleapis.com/androidpublisher/v2/applications/packageName/purchase
s/subscriptions/subscriptionId/tokens/token

I have added all the .jar files in Android studio. The project is building 
successfully but If RUN the application, it is giving me the following error.

=======Error=======
Error:Execution failed for task ':TheGrind:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    D:\Program Files\Android\android-studio\sdk\build-tools\20.0.0\dx.bat --dex --output D:\OfficeWork\AndroidProjects\GrindWorkspace\AndroidStudio\TheGrind\TheGrind\build\intermediates\pre-dexed\debug\transaction-api-1.1-45e1c03e34096d675e87ac2fb40558f3bed018a6.jar D:\OfficeWork\AndroidProjects\GrindWorkspace\AndroidStudio\TheGrind\TheGrind\libs\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.
    This is often due to inadvertently including a core library file
    in your application's project, when using an IDE (such as
    Eclipse). If you are sure you're not intentionally defining a
    core class, then this is the most likely explanation of what's
    going on.
    However, you might actually be trying to define a class in a core
    namespace, the source of which you may have taken, for example,
    from a non-Android virtual machine project. This will most
    assuredly not work. At a minimum, it jeopardizes the
    compatibility of your app with future versions of the platform.
    It is also often of questionable legality.
    If you really intend to build a core library -- which is only
    appropriate as part of creating a full virtual machine
    distribution, as opposed to compiling an application -- then use
    the "--core-library" option to suppress this error message.
    If you go ahead and use "--core-library" but are in fact
    building an application, then be forewarned that your application
    will still fail to build or run, at some point. Please be
    prepared for angry customers who find, for example, that your
    application ceases to function once they upgrade their operating
    system. You will be to blame for this problem.
    If you are legitimately using some code that happens to be in a
    core package, then the easiest safe alternative you have is to
    repackage that code. That is, move the classes in question into
    your own package namespace. This means that they will never be in
    conflict with core system classes. JarJar is a tool that may help
    you in this endeavor. If you find that you cannot do this, then
    that is an indication that the path you are on will ultimately
    lead to pain, suffering, grief, and lamentation.
    1 error; aborting
================================

How would you expect it to be fixed?
According to documentation for gradel, I have also added the following lines in 
gradle.

repositories {
    mavenCentral()
}
dependencies {
compile 'com.google.api-client:google-api-client:1.19.0'
}

But the error same. It should be run successfully

Please guide me what I have to do? Many Thanks.

Original issue reported on code.google.com by asifjava...@gmail.com on 2 Sep 2014 at 9:44

GoogleCodeExporter commented 9 years ago
This seems to be due to your inclusion of the Transaction API. You don't need 
it for Android applications. Can you take a look at your build.gradle and your 
/libs directory?

Instructions on Android application dependencies: 
https://code.google.com/p/google-api-java-client/wiki/Setup#Android

Also a sample for Android application: 
https://code.google.com/p/google-api-java-client/source/browse/calendar-android-
sample/build.gradle?repo=samples

Original comment by wonder...@google.com on 29 Dec 2014 at 8:15