Azure / azure-storage-android

Microsoft Azure Storage Library for Android
Apache License 2.0
81 stars 48 forks source link

aar 0.2.0 is a zip filen in Maven #3

Closed oliverhausler closed 10 years ago

oliverhausler commented 10 years ago

The aar in Maven is a zip file, which means gradle will not download and/or use the library.

Look here: http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22azure-storage-android%22

oliverhausler commented 10 years ago

I downloaded the file and renamed it to aar but it seems like the file doesn't work as aar.

[Gradle can see the file when using compile files('/libs/azure-storage-android-0.2.0.aar'), but it is marked "?" in Android Studio 0.8.1, which I don't know if it is normal when using an aar instead of a jar.]

oliverhausler commented 10 years ago

I was wrong, on the web, it seems to be an aar file. The problem is caused by Windows as it looks, which converts the file to zip during download. [Rightclick, Save as... and I am offered .zip!?] Well, for whatever reason, it doesn't work in gradle either. I am further investigating this issue and will post any new findings.

oliverhausler commented 10 years ago

More info: I realized your aar contains a root folder with the package name, while all other aars in Maven that I picked and anaylzed do not contain that root folder. Not sure if this is what causes my problem. Android Studio also shows "?" for the other aars, so the problem may be the new version of Android Studio as well (too new, so no idea how it behaves, sorry).

What I have tried is repackaging your aar without the root folder, but it isn't recognized that way either.

oliverhausler commented 10 years ago

I finally extracted the classes.jar from the aar and voila. Working fine.

What is the reasoning of using an aar instead of a jar? What you did in replacing the dependencies which caused trouble in Android makes perfect sense, but why do we need an aar if there are no further resources for Android? The only pro that I can see is that users don't confuse the libraries.

emgerner-msft commented 10 years ago

The reason we choose to release an aar is because from my understanding that is what Google recommends going forward. The standard Android documentation on project management explicitly states that libraries cannot be exported as jars, and while we realize that on a technical level that that is because of resource files, we nonetheless want to follow the guidelines Google states.

If you have time, I'd like to figure out the issue with our aar - could you try one thing? When you unzipped the aar, you got that root folder. Could you zip that and rename to an aar and see if you can import that to Android Studio?

In any case, I'm glad to hear you got things working with the jar, if you have any additional questions or feedback about the library itself we'd love to hear from you!

oliverhausler commented 10 years ago

Thank you Emily,

I tried zipping your content another time, with and without the root folder, but Android studio did not accept it. Interestingly, when I drop it in as a ZIP (and without renaming to AAR), it recognizes the content. But then I can’t use it as a library.

I know there were limitations before 0.8.0 when it came to using aar in libs, but that limitation supposedly has been removed with the release of the beta. I couldn’t find much on the web yet, so I can’t say if I did something wrong or if it is a bug in Android Studio.

Oliver.

PS: I just posted a question on stackoverflow a few moments ago where I asked for feedback why content-length needs to be specified before uploading. I don’t see much sense in that parameter but I realized it comes from the original libraries, not from your Android project only. You may still want to have a look at this: http://stackoverflow.com/questions/24618545/can-i-upload-a-stream-to-azure-blob-storage-without-specifying-its-length-upfron

From: Emily Gerner [mailto:notifications@github.com] Sent: Monday, July 7, 2014 11:26 AM To: Azure/azure-storage-android Cc: Oliver Hausler Subject: Re: [azure-storage-android] aar 0.2.0 is a zip filen in Maven (#3)

The reason we choose to release an aar is because from my understanding that is what Google recommends going forward. The standard Android documentation on project managementhttp://developer.android.com/tools/projects/index.html explicitly states that libraries cannot be exported as jars, and while we realize that on a technical level that that is because of resource files, we nonetheless want to follow the guidelines Google states.

If you have time, I'd like to figure out the issue with our aar - could you try one thing? When you unzipped the aar, you got that root folder. Could you zip that and rename to an aar and see if you can import that to Android Studio?

In any case, I'm glad to hear you got things working with the jar, if you have any additional questions or feedback about the library itself we'd love to hear from you!

— Reply to this email directly or view it on GitHubhttps://github.com/Azure/azure-storage-android/issues/3#issuecomment-48219713.

emgerner-msft commented 10 years ago

Answered your question on Stack Overflow as the initial one posted by another user was not correct. Feel free to ask any follow up questions either here or on Stack Overflow.

I'm working with Android Studio now to try to figure out the zip/aar issue and will post a fix as soon as I have one. Sorry for the inconvenience and thanks for all the issue details.

Thanks! Emily

oliverhausler commented 10 years ago

Thanks, and don’t worry about the aar, as I can work with the jar for the moment and my project will need another two months to go productive. So take your time.

From: Emily Gerner [mailto:notifications@github.com] Sent: Monday, July 7, 2014 4:34 PM To: Azure/azure-storage-android Cc: Oliver Hausler Subject: Re: [azure-storage-android] aar 0.2.0 is a zip filen in Maven (#3)

Answered your question on Stack Overflow as the initial one posted by another user was not correct. Feel free to ask any follow up questions either here or on Stack Overflow.

I'm working with Android Studio now to try to figure out the zip/aar issue and will post a fix as soon as I have one. Sorry for the inconvenience and thanks for all the issue details.

Thanks! Emily

— Reply to this email directly or view it on GitHubhttps://github.com/Azure/azure-storage-android/issues/3#issuecomment-48254949.

emgerner-msft commented 10 years ago

I tried remaking the aar and it works just fine for me now in Android Studio. There was a formatting issue inside the 0.2.0 aar which caused issues with Android Studio. This is fixed in 0.2.1 which is now posted to Maven. Give it a try and tell me if it works for you!

More info: As you noted, the aar on Maven always had the correct extension but showed as a zip in Android Studio. Since an aar is just a specifically formatted and renamed zip, I think it might be Android studio unpackaging it. Also, I made a dummy aar and that also shows as a '?' in Android Studio so I think that's correct.

oliverhausler commented 10 years ago

I was on the road today. Will review this tomorrow and let you know. Thanks for fixing this so quick.

Regarding the aar I think it's Windows or IE which looks inside the file while downloading and recognizes and shows it as zip. Once you select Save... it wants to save as zip. That behaviour is consistent with other aars on Maven.

-------- Original message -------- From: Emily Gerner Date:2014/07/09 10:59 (GMT-08:00) To: Azure/azure-storage-android Cc: Oliver Hausler Subject: Re: [azure-storage-android] aar 0.2.0 is a zip filen in Maven (#3)

I tried remaking the aar and it works just fine for me now in Android Studio. There was a formatting issue inside the 0.2.0 aar which caused issues with Android Studio. This is fixed in 0.2.1 which is now posted to Maven. Give it a try and tell me if it works for you!

More info: As you noted, the aar on Maven always had the correct extension but showed as a zip in Android Studio. Since an aar is just a specifically formatted and renamed ziphttp://tools.android.com/tech-docs/new-build-system/aar-format, I think it might be Android studio unpackaging it. Also, I made a dummy aar and that also shows as a '?' in Android Studio so I think that's correct.

Reply to this email directly or view it on GitHubhttps://github.com/Azure/azure-storage-android/issues/3#issuecomment-48510844.

oliverhausler commented 10 years ago

Hi Emily,

Sorry for the delay.

I can now pull the aar from Maven using Android Studio and gradle:

dependencies { compile 'com.microsoft.azure.android:azure-storage-android:0.2.1@aar' }

Now I run into the following exception during compile:

uses-sdk:minSdkVersion 9 cannot be smaller than version 15 declared in library com.microsoft.azure.android:azure-storage-android:0.2.1 Error:Execution failed for task ':android:processDebugManifest'.

Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 15 declared in library com.microsoft.azure.android:azure-storage-android:0.2.1

I saw in your documentation that you don’t support older versions of Android, so the exception is consistent with that. Two things I wanted to notice:

Oliver.

From: Emily Gerner [mailto:notifications@github.com] Sent: Wednesday, July 9, 2014 11:00 AM To: Azure/azure-storage-android Cc: Oliver Hausler Subject: Re: [azure-storage-android] aar 0.2.0 is a zip filen in Maven (#3)

I tried remaking the aar and it works just fine for me now in Android Studio. There was a formatting issue inside the 0.2.0 aar which caused issues with Android Studio. This is fixed in 0.2.1 which is now posted to Maven. Give it a try and tell me if it works for you!

More info: As you noted, the aar on Maven always had the correct extension but showed as a zip in Android Studio. Since an aar is just a specifically formatted and renamed ziphttp://tools.android.com/tech-docs/new-build-system/aar-format, I think it might be Android studio unpackaging it. Also, I made a dummy aar and that also shows as a '?' in Android Studio so I think that's correct.

— Reply to this email directly or view it on GitHubhttps://github.com/Azure/azure-storage-android/issues/3#issuecomment-48510844.

emgerner-msft commented 10 years ago

Hi Oliver,

Glad the aar is working now.

Supporting further back than 15 does have compelling arguments but it is not as trivial as changing the minSdkVersion. There are serious code compatibility issues that have nothing to do with frontend Android code. Android API 8 has a significantly smaller features set than API 15 and many basic functions are missing (a simple example being String.isEmpty()). There are many bugs (see the Date and HttpURLConnection classes) that have been fixed since then that are hit in older versions and would require workarounds. Besides code changes, this would also mean a much larger test footprint going forward.

All that being said, we are already aware of this issue and have it on our radar. If you would like, you can open up a separate issue for it on this repository for tracking and I'll make sure to update that if anything changes.

Thank you for your feedback! Emily

oliverhausler commented 10 years ago

Thank you Emily, I will do that, and I will also post my results there once I get into testing on previous APIs.

From: Emily Gerner [mailto:notifications@github.com] Sent: Wednesday, July 16, 2014 3:06 PM To: Azure/azure-storage-android Cc: Oliver Hausler Subject: Re: [azure-storage-android] aar 0.2.0 is a zip filen in Maven (#3)

Hi Oliver,

Glad the aar is working now.

Supporting further back than 15 does have compelling arguments but it is not as trivial as changing the minSdkVersion. There are serious code compatibility issues that have nothing to do with frontend Android code. Android API 8 has a significantly smaller features set than API 15 and many basic functions are missing (a simple example being String.isEmpty()). There are many bugs (see the Date and HttpURLConnection classes) that have been fixed since then that are hit in older versions and would require workarounds. Besides code changes, this would also mean a much larger test footprint going forward.

All that being said, we are already aware of this issue and have it on our radar. If you would like, you can open up a separate issue for it on this repository for tracking and I'll make sure to update that if anything changes.

Thank you for your feedback! Emily

— Reply to this email directly or view it on GitHubhttps://github.com/Azure/azure-storage-android/issues/3#issuecomment-49234241.

emgerner-msft commented 10 years ago

Great, thanks. I'm going to close this thread then as the original aar issue was solved. Further discussion on back compat will go in the new issue thread.