Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot extract android-sdk-preview.jar #36

Closed
jurschreuder opened this issue Mar 28, 2014 · 12 comments
Closed

cannot extract android-sdk-preview.jar #36

jurschreuder opened this issue Mar 28, 2014 · 12 comments

Comments

@jurschreuder
Copy link

I tried to use the .jar file in Android Studio, but it seems it cannot extract the zip.
Is android-sdk-preview.jar ready to use?
Am I doing something wrong?
I don't know, hope you can help me :)

Cheers Jurriaan

@wiktor
Copy link
Contributor

wiktor commented Mar 28, 2014

Although jar files are zips, they should not be extracted.

Just add this jar as a external library.

@jurschreuder
Copy link
Author

Thanks for your very fast reply!

I tried to do just that, adding it as a file dependency, but I get this error when building:
Error:: error reading /libs/estimote-sdk-preview.jar; error in opening zip file

Just to make sure I wasn't doing anything wrong (haven't programmed Android in a while and Android Studio changes very fast) I tried adding gson-2.2.4.jar. That works just fine. It builds and I can view the content of gson-2.2.4.jar (little triangle appears, I can access it as a folder).

Maybe this is an issue with Android Studio? I can try installing Eclipse.

Thanks again for your fast reply!

@wiktor
Copy link
Contributor

wiktor commented Mar 28, 2014

Which version of Android Studio you are using?
Can you tell me how do you add library?

On Fri, Mar 28, 2014 at 10:02 AM, jurschreuder notifications@github.comwrote:

Thanks for your very fast reply!

I tried to do just that, adding it as a file dependency, but I get this
error when building:
Error:: error reading /libs/estimote-sdk-preview.jar; error in opening zip
file

Just to make sure I wasn't doing anything wrong (haven't programmed
Android in a while and Android Studio changes very fast) I tried adding
gson-2.2.4.jar. That works just fine. It builds and I can view the content
of gson-2.2.4.jar (little triangle appears, I can access it as a folder).

Maybe this is an issue with Android Studio? I can try installing Eclipse.

Thanks again for your fast reply!


Reply to this email directly or view it on GitHubhttps://github.com//issues/36#issuecomment-38899382
.

@jurschreuder
Copy link
Author

I use Android Studio 0.5.1

I copied the jar in the libs folder.

right-click on project -> Open Module Settings -> Dependencies -> + -> File Dependency -> estimote-sdk-preview.jar

and in build.gradle my dependencies look like this:

dependencies {
compile files('libs/gson-2.2.4.jar')
compile files('libs/estimote-sdk-previes.jar')
compile 'com.android.support:appcompat-v7:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}

I used to only manually add the bottom line, but now it seems like this line is already there in 0.5.1 and Android Studio also automatically ads the "compile files('libs/estimote-sdk-previes.jar')" line, although I would think it would also work with just the bottom line.

Also, when I right-click on the jar and select "add as library", it displays the following menu, which it didn't display with gson:

jar problem

@wiktor
Copy link
Contributor

wiktor commented Mar 28, 2014

If I read it correctly:

"compile fileTree(dir: 'libs', include: ['*.jar'])" - means that to include all jars in a directory

so you don't need those two:
compile files('libs/gson-2.2.4.jar')
compile files('libs/estimote-sdk-previes.jar')

@jurschreuder
Copy link
Author

Yeah I think so to.
Ah yeah they might be conflicting.... let's try removing one of them...
No that's not it, still not working, same error. Although I think I remember these things conflicting in older versions of Android Studio/Gradle yes. But gson works just fine with both, and removing one of them did not help :(

Is this .jar confirmed to work with Android Studio? Then at least I will know that it's not a problem with the .jar file. Or maybe that I can just fix it by using Eclipse.

@jurschreuder
Copy link
Author

He wiktor!

Just in case this was an Android Studio problem (I wouldn't be surprised), I just installed good-old Eclipse. In Eclipse I get the same error:

Archive for required library: '<my_path>/libs/estimote-sdk-preview.jar' in project '' cannot be read or is not a valid ZIP file.

So I guess it is really a problem with the estimote-sdk-preview.jar file.

@wiktor
Copy link
Contributor

wiktor commented Mar 28, 2014

Strange it works for me.

  1. There is typo in >> compile files('libs/estimote-sdk-previes.jar')

  2. In Android Studio you add external dependency in Project Structure > Modules > Dependencies. There is small plus sign on the bottom and choose "File dependency" and choose a file.

@jurschreuder
Copy link
Author

Yeah there was I typo sorry my bad. But I deleted all lines except the include ['*.jar'] one, when you suggested the thing about the duplicates, and still the same error.

About the plus sign, I did just that. Add a file dependency.

It's strange that I get the same error in Eclipse.

Can you maybe email me a version of the estimote-sdk-preview.jar file that you have in a working project? That would help me out a lot!

I am on a Big Mac right now, because I am also developing the exact same thing for iOS at the same time. I am going to boot up some other operating systems and see what they think of the .jar file...

@wiktor
Copy link
Contributor

wiktor commented Mar 28, 2014

contact me at wiktor at estimote dot com

On Fri, Mar 28, 2014 at 11:30 AM, jurschreuder notifications@github.comwrote:

Yeah there was I typo sorry my bad. But I deleted all lines except the
include ['*.jar'] one, when you suggested the thing about the duplicates,
and still the same error.

About the plus sign, I did just that. Add a file dependency.

It's strange that I get the same error in Eclipse.

Can you maybe email me a version of the estimote-sdk-preview.jar file that
you have in a working project? That would help me out a lot!

I am on a Big Mac right now, because I am also developing the exact same
thing for iOS at the same time. I am going to boot up some other operating
systems and see what they think of the .jar file...


Reply to this email directly or view it on GitHubhttps://github.com//issues/36#issuecomment-38905586
.

@jurschreuder
Copy link
Author

I downloaded the file the wrong way (by right clicking the estimote-sdk-preview.jar link and select download). This actually saved an HTML page with the filename estimote-sdk-preview.jar, so this was actually just a .html file with a .jar extension.

Stupid mistake.
Thread closed.

@raarlac
Copy link

raarlac commented Apr 22, 2014

@jurschreuder thank you!!! I was doing the same haha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants