Giter VIP home page Giter VIP logo

Comments (20)

niqo01 avatar niqo01 commented on August 15, 2024

I just saw this line before the exception:

6293-6293/com.couchsurfing.mobile.debug W/dalvikvm﹕ Exception Ljava/lang/IllegalStateException; thrown while initializing Lcom/amazonaws/internal/config/InternalConfig$Factory;

from aws-sdk-android.

niqo01 avatar niqo01 commented on August 15, 2024

I found and solve the issue. aws-android-sdk-2.0.5-core.jar include a file named awssdk_config_default.json which is not a valid json. Removing the "java style" comment solve the issue...

from aws-sdk-android.

wdane avatar wdane commented on August 15, 2024

Hey niqo01,

I really appreciate you posting the issue and fix! Would you be able to give us an example of how you were initializing the Transfer Manager. This issue never came up in our testing and I'd like to learn why so we can fix it for our future releases. I'm assuming you were also using version 2.0.5 of S3?

Thanks,
Weston

from aws-sdk-android.

niqo01 avatar niqo01 commented on August 15, 2024

Yes, I am also using 2.0.5 of S3 . My test code looks like this

public TransferManager getTransferManager()
    return new TransferManager(  new BasicAWSCredentials( AWS_S3_ACCESS_KEY, AWS_S3_SECRET_ACCESS_KEY ));
  }

The code crashed directly at the TransferManager creation

from aws-sdk-android.

richardfung avatar richardfung commented on August 15, 2024

Hi, thanks for helping us improve the SDK!

We aren't able to reproduce this issue so it would be awesome if you could provide us with a few more details. Namely,

  1. Version of Android you are compiling against
  2. Whether you are using the core jar which includes or doesn't include third party libraries
  3. Your development environment
  4. Are you compiling in debug/release mode and with or without proguard?

Thanks again!

from aws-sdk-android.

niqo01 avatar niqo01 commented on August 15, 2024
  1. SDK version 19
  2. Core jar with third party libraries. Could I just use the one without the third party dependencies ?
  3. Android Studio 0.8.4 / Gradle Android 0.12.2 / Gradle 1.12
  4. debug with proguard

from aws-sdk-android.

ma-hussain avatar ma-hussain commented on August 15, 2024

Hey niqo01,
I am also stuck with the same error since last 2 days.... In one of your above comments I read that you have resolved it.
Sorry but I am unable to understand your solution, can you please clarify a little more ??
If you can show me the updated awssdk_config_default.json file ..... Thanks in advance...

from aws-sdk-android.

niqo01 avatar niqo01 commented on August 15, 2024

@ma-hussain The fix which worked for me is to:

  1. Open aws-android-sdk-2.0.5.jar with a zip tool,
  2. Open awssdk_config_default.json file and remove the comments (line starting with //). I recommend to check the result json with a json validator like http://jsonlint.com/
  3. replace the new file in the jar.
  4. Use the new file jar as a dependency.

from aws-sdk-android.

ma-hussain avatar ma-hussain commented on August 15, 2024

@niqo01 I have removed the commented lines but still I am getting errors. Can you explain what was wrong with the comment in awssdk_config_default.json file and why just removing a comment in the file worked for you ??
Below is the error I am getting:

08-06 18:26:31.650: I/VersionInfoUtils(20672): Unable to load version information for the running SDK: /com/amazonaws/sdk/versionInfo.properties not found on classpath
08-06 18:26:31.670: W/dalvikvm(20672): VFY: unable to find class referenced in signature (Lcom/fasterxml/jackson/databind/ObjectMapper;)
08-06 18:26:31.670: I/dalvikvm(20672): Could not find method com.fasterxml.jackson.databind.ObjectMapper.readValue, referenced from method com.amazonaws.internal.config.InternalConfig.loadfrom
08-06 18:26:31.670: W/dalvikvm(20672): VFY: unable to resolve virtual method 18785: Lcom/fasterxml/jackson/databind/ObjectMapper;.readValue (Ljava/net/URL;Ljava/lang/Class;)Ljava/lang/Object;
08-06 18:26:31.670: D/dalvikvm(20672): VFY: replacing opcode 0x6e at 0x000e
08-06 18:26:31.680: W/dalvikvm(20672): Exception Ljava/lang/IllegalArgumentException; thrown while initializing Lcom/amazonaws/internal/config/InternalConfig$Factory;
08-06 18:26:31.690: I/dalvikvm(20672): Rejecting re-init on previously-failed class Lcom/amazonaws/internal/config/InternalConfig$Factory; v=0x0
08-06 18:26:31.690: D/AndroidRuntime(20672): Shutting down VM
08-06 18:26:31.690: W/dalvikvm(20672): threadid=1: thread exiting with uncaught exception (group=0x40a241f8)

E/AndroidRuntime(19831): FATAL EXCEPTION: main
08-06 17:45:08.470: E/AndroidRuntime(19831): java.lang.NoClassDefFoundError: com/amazonaws/internal/config/InternalConfig$Factory
08-06 17:45:08.470: E/AndroidRuntime(19831): at com.amazonaws.ServiceNameFactory.getServiceName(Unknown Source)
08-06 17:45:08.470: E/AndroidRuntime(19831): at com.amazonaws.AmazonWebServiceClient.computeServiceName(Unknown Source)
08-06 17:45:08.470: E/AndroidRuntime(19831): at com.amazonaws.AmazonWebServiceClient.getServiceNameIntern(Unknown Source)
08-06 17:45:08.470: E/AndroidRuntime(19831): at com.amazonaws.AmazonWebServiceClient.computeSignerByURI(Unknown Source)
08-06 17:45:08.470: E/AndroidRuntime(19831): at com.amazonaws.AmazonWebServiceClient.setEndpoint(Unknown Source)
08-06 17:45:08.470: E/AndroidRuntime(19831): at com.amazonaws.services.s3.AmazonS3Client.setEndpoint(Unknown Source)
08-06 17:45:08.470: E/AndroidRuntime(19831): at com.amazonaws.services.s3.AmazonS3Client.init(Unknown Source)
08-06 17:45:08.470: E/AndroidRuntime(19831): at com.amazonaws.services.s3.AmazonS3Client.(Unknown Source)
08-06 17:45:08.470: E/AndroidRuntime(19831): at com.amazonaws.services.s3.AmazonS3Client.(Unknown Source)
08-06 17:45:08.470: E/AndroidRuntime(19831): at com.amazonaws.services.s3.AmazonS3Client.(Unknown Source)
08-06 17:45:08.470: E/AndroidRuntime(19831): at com.amazonaws.services.s3.transfer.TransferManager.(Unknown Source)
08-06 17:45:08.470: E/AndroidRuntime(19831): at com.zahdoo.android.extension.GCM.FileTransferActivity.onCreate(FileTransferActivity.java:77)
08-06 17:45:08.470: E/AndroidRuntime(19831): at android.app.Activity.performCreate(Activity.java:4465)
08-06 17:45:08.470: E/AndroidRuntime(19831): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
08-06 17:45:08.470: E/AndroidRuntime(19831): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
08-06 17:45:08.470: E/AndroidRuntime(19831): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
08-06 17:45:08.470: E/AndroidRuntime(19831): at android.app.ActivityThread.access$600(ActivityThread.java:123)
08-06 17:45:08.470: E/AndroidRuntime(19831): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
08-06 17:45:08.470: E/AndroidRuntime(19831): at android.os.Handler.dispatchMessage(Handler.java:99)
08-06 17:45:08.470: E/AndroidRuntime(19831): at android.os.Looper.loop(Looper.java:137)
08-06 17:45:08.470: E/AndroidRuntime(19831): at android.app.ActivityThread.main(ActivityThread.java:4424)
08-06 17:45:08.470: E/AndroidRuntime(19831): at java.lang.reflect.Method.invokeNative(Native Method)
08-06 17:45:08.470: E/AndroidRuntime(19831): at java.lang.reflect.Method.invoke(Method.java:511)
08-06 17:45:08.470: E/AndroidRuntime(19831): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-06 17:45:08.470: E/AndroidRuntime(19831): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-06 17:45:08.470: E/AndroidRuntime(19831): at dalvik.system.NativeStart.main(Native Method)

from aws-sdk-android.

niqo01 avatar niqo01 commented on August 15, 2024

@ma-hussain just copy the content of the awssdk_config_default.json in the following json validator website: http://jsonlint.com/ and hit validate.

Also you can read here more about comment in json file: http://stackoverflow.com/questions/244777/can-i-comment-a-json-file

from aws-sdk-android.

richardfung avatar richardfung commented on August 15, 2024

@ma-hussain If you are using proguard can you post your proguard config? Also we are looking into this json file issue.

from aws-sdk-android.

ma-hussain avatar ma-hussain commented on August 15, 2024

Let me explain my issue properly...

I need to use S3 in my mobile app which is built using Adobe Flex and we are accessing all the native java android feature by creating ActionScript Native Extensions(ANE) which allows me incorporate native platform capabilities into my application and use them like standard libraries..

So, I downloaded the S3 java android sample executed it and it is working fine, I can upload/download my files to/from my S3 bucket. I included aws-android-sdk-2.0.5-s3.jar and aws-android-sdk-2.0.5-core.jar into the libs folder and everything is working fine.

But when I am merging the code with my Java ANE , I am using the the aws-sdk core and s3 jar. It is compiling without any errors, I create the ANE from it and add it to my Flex app but when I run my Flex app ,it is giving me those errors just when initializing TransferManager..

from aws-sdk-android.

wdane avatar wdane commented on August 15, 2024

Hey ma-hussain,

We've seen a number of cross-platform development tools strip out non-java files from jars in the past. It looks to me like Flex is stripping these files out of our SDK jars. Can you verify if this is the case, and if so see if Flex provides an options for not stripping out these files?

Thanks,
Weston

from aws-sdk-android.

ma-hussain avatar ma-hussain commented on August 15, 2024

@wdane May be you are correct . But I have not yet come across a solution to stop Flex from stripping the non-java files. I am still working on it.

By the way can you tell me whether any AWS S3 sdk is available for Adobe Flex.
I have found some links ,but they dont have a proper documentation. Can you please check these below:
i.) https://aws.amazon.com/articles/Amazon-S3/2434
ii.) https://code.google.com/p/as3awss3lib/

from aws-sdk-android.

wdane avatar wdane commented on August 15, 2024

@ma-hussain Unfortunately we do not currently support Adobe Flex, the AWS article is not specifically targeting mobile developers using our SDK. The second link is not something that has been produced by Amazon so I cannot help in that regard.

However another customer has had a similar issue and has provided detailed steps as to how to get around it. He is using Adobe Air, but the solutions should be relatively universal for cross compilers stripping out non-java files. https://forums.aws.amazon.com/thread.jspa?messageID=562833&#562833

from aws-sdk-android.

ma-hussain avatar ma-hussain commented on August 15, 2024

@wdane Hey Weston ,
After going through the above link you provided and doing some modifications I was finally able to use Amazon AWS S3 from my Adobe Flex app.
The process is a little complex but after the initial hiccups it was done
Thanks a LOT...
I will post the whole process here soon...

from aws-sdk-android.

wdane avatar wdane commented on August 15, 2024

@ma-hussain
Really glad to hear you got it working!

from aws-sdk-android.

ma-hussain avatar ma-hussain commented on August 15, 2024

To use Amazon S3 for Adobe Flex/Action Script mobile app using JAVA ANE, follow the following procedure. You must have prior knowledge on how to create ANE(Air Native Extension).

But before going through the below steps I suggest you go through this link
-> https://forums.aws.amazon.com/thread.jspa?messageID=562833#562833.
See the 4th comment .I got it working with the help of that.

1.) First of all copy the 'fasterxml' folder inside the 'com' folder of your ANENative project by using Windows explorer.
Actually I was getting some error related to jackson-core so I downloaded the 'jackson-core-2.1.5.jar' from the following link

-> http://grepcode.com/snapshot/repo1.maven.org/maven2/com.fasterxml.jackson.core/jackson-core/2.1.5  

From this jar I extracted the files which were missing and put it into the 'fasterxml' folder

Here is the link of the 'fasterxml' folder in case you need it.
->https://www.dropbox.com/s/e36n2csvsmyiycs/fasterxml.zip?dl=0

 Directly copy this 'fasterxml' folder inside the 'com' folder of your ANENative project by using Windows explorer not using your IDE.

If you want to reproduce the same error you can skip this step. This will help you understand the reason I needed this 'fasterxml' folder.

2.)After your java android ANENative project is ready with all the S3 code with the 'aws-android-sdk-2.0.5-core.jar' and 'aws-android-sdk-2.0.5-s3.jar' inside the libs folder, export your ANENative project to a jar file say ANENative.jar .

3.)After step 2, we need to extract 'aws-android-sdk-2.0.5-core.jar' and 'aws-android-sdk-2.0.5-s3.jar' into 2 different folders.

If you dont have the above jar files, download it from this link - > 'http://aws.amazon.com/sdk-for-android/'

copy the ANENative.jar file to the folder containing the extracted "aws-android-sdk-2.0.5-core" package and files from 'aws-android-sdk-2.0.5-core.jar' library and run the following commands

i.)jar -uf ANENative.jar com  
ii.)jar -uf ANENative.jar org   
iii.)jar -uf ANENative.jar META-INF
iv.)jar -uf ANENative.jar awssdk_config_default.json
v.)jar -uf ANENative.jar mime.types

Note:Here merging 'javax' folder is not necessary as it is empty

3.) copy the modified ANENative.jar file to the folder containing the extracted "aws-android-sdk-2.0.5-s3" package and files from 'aws-android-sdk-2.0.5-s3.jar' library and run the following commands

i.)jar -uf ANENative.jar com 

Note:Here merging 'META-INF' is not necessary   

4.)Now use this 'ANENative.jar' to create the ANE.

5.)Add the created ANE to build path Native Extensions of your Adobe Flex mobile project.

6.)Export the release build using the regular technique by Adobe Flash Builder to get the .apk file

7.)IMPORTANT: Now from the extracted folders of the 'aws-android-sdk-2.0.5-core.jar' and 'aws-android-sdk-2.0.5-s3.jar' file remove all the non-class files and keep the remaining files in another seperate folder with the package structure intact.

Here is the link of the extracted jar without the class files in case you need it.(Otherwise it takes a lot of time to manually find and remove all the class files)
https://www.dropbox.com/s/bqevt7d4et1opv2/AWS_LIBS_NO_CLASS.zip?dl=0

i.)This folder should contain 'com' folder, 'org' folder , awssdk_config_default.json file and mime.types file.
ii.) copy the generated .apk  file in the above folder.
iii.) Open the .apk file with WINRAR, on the top right you will see an 'Add' icon.
iv.) Add one by one all the four items in this apk.('com' folder, 'org' folder , awssdk_config_default.json file and mime.types 

file)

Note:Step iv) is alternative to 'aapt add ANENative.jar <path to file> '.  As we have to run this command to many files 

therefore opted to add them using WINRAR as described in Step iv

8.)Remove the previous signing bits, 'aapt remove ' for CERT.RSA, 'CERT.SF, MANIFEST.MF in META-INF

i.)aapt remove <apk> META-INF/MANIFEST.MF
ii.)aapt remove <apk> META-INF/CERT.RSA
iii.)aapt remove <apk> META-INF/CERT.SF

9.) Resign the apk with 'jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore '

10.)Realign the apk with zipalign 'zipalign -v 4 <apk_prealign> '

NOW WE ARE DONE. Install the apk and Amazon S3 should work now

Hope this may help someone who needs to use Amazon S3 using Flex mobile app

from aws-sdk-android.

wdane avatar wdane commented on August 15, 2024

Would like to thank everyone for contributing all of their experiences and help. Closing the issue, as it seems like solid work-arounds have been found though we will be looking into making this easier in the future.

from aws-sdk-android.

mtrewartha avatar mtrewartha commented on August 15, 2024

We actually still get this error in a native Android app, even when ProGuard is disabled, using 2.1.7. Have you guys seen any more issues crop up with this?

from aws-sdk-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.