How to use zip plugin

yanuar,

Corona Enterprise does not include any plugin libraries.  You have to download them separately on our Corona Enterprise daily build page via the link below.  Also note that if you are a trial user (ie: you do not have an Enterprise subscription yet), then you do not have access to this webpage.  You should contact the person who provided you the Corona Enterprise trial for a copy of the plugins.

   http://developer.coronalabs.com/downloads/enterprise-daily-builds

Also note that you are no longer building with Corona anymore.  You are building with the Android SDK and you now must include/reference libraries into your Android application project according to Google’s documentation.  This means referencing an Android library project folder via the “project.properties” file or adding *.jar and *.so files to your project’s “libs” directory.  You only do one or the other for a single library.  The “project.properties” file is the preferred route if possible.  Corona Enterprise sample project “IncludeAllFeatures” demonstrates how to include the Facebook library via the “project.properties” and Flurry via the “libs” directory, which serves as a good example.

Also note that the “build.settings” file is ignored for native Android SDK builds.  That file is for Corona Simulator builds.  So, whatever you’re doing in your “build.settings” file, you’ll have to do the native Android way, such as adding permissions to your AndroidManifest.xml file yourself.  Corona’s “Icon-xhdpi.png” and other app icons are ignored for native Android builds as well since those are Corona Simulator build related files.  The native Android way of doing this is adding those files to the appropriate “res” directories and referencing them in your AndroidManifest.xml file.  All of this is documented on Google’s end.

Thanks Joshua,

Just got my license and plugins today but still having trouble with the plugins. Do I need to change anything in my lua to get the plugin?

I already set the project.properties to point at the plugin libs folder or put the .so in my libs folder but I still get this :

12-04 04:09:03.210 I/Corona  (6072):     no field package.preload[‘plugin.zip’]

12-04 04:09:03.210 I/Corona  (6072):     no file ‘(null)/plugin.zip.lua’

12-04 04:09:03.210 I/Corona  (6072):     no file ‘(null)/plugin.zip.lua’

12-04 04:09:03.210 I/Corona  (6072):     no file ‘/data/data/com.iplayalldaystudio.KQIPlayJoy/lib/libplugin.zip.so’

12-04 04:09:03.210 I/Corona  (6072):     no file ‘./plugin.zip.so’

12-04 04:09:03.210 I/Corona  (6072):     no file ‘(null)/plugin.zip.so’

12-04 04:09:03.210 I/Corona  (6072):     no file ‘/data/data/com.iplayalldaystudio.KQIPlayJoy/lib/libplugin.so’

12-04 04:09:03.210 I/Corona  (6072):     no file ‘./plugin.so’

12-04 04:09:03.210 I/Corona  (6072):     no file ‘(null)/plugin.so’

12-04 04:09:03.210 I/Corona  (6072): stack traceback:

12-04 04:09:03.210 I/Corona  (6072):     [C]: ?

12-04 04:09:03.210 I/Corona  (6072):     [C]: in function ‘require’

12-04 04:09:03.210 I/Corona  (6072):     ?: in function ‘require’

12-04 04:09:03.210 I/Corona  (6072):     ?: in main chunk

I’m suspicious about the way I call the plugin using “require” in my lua?

Thanks

I think you copied the *.so libraries to the wrong location since those are the libraries the application is failing to load.

*.jar files must be copied to the “libs” directory.

*.so files must be copied to the “libs/armeabi-v7a” directory.

Yup,

Sorry for asking, I realized that as soon as I posted this :slight_smile:

On a different note, the only that isn’t working from me regarding the zip plugin is that somehow I can’t find my unzipped files.

So, this is what happened :

  1. I have a zip file on my res, (it’s stored on assets)
  2. In my corona app, I unzip the file to the cache and document folder. This is supposed to work since I don’t get any error message from the zip plugin.
  3. The code where I read my files are no longer working, all saying unable to find files
  4. I dump the pathname for those files and they seems correct.

Check list :

  1. Already set the persmission to write_external_storage

  2. No error message from zip.uncompress

  3. I use these code to read files :

    local fullpath = system.pathForFile(fname, system.DocumentsDirectory) local hFile,err = io.open(fullpath ,“r”);  

My lua works just fine if I compiled using Pro 
Any ideas?

 

Hmm… I’m not sure what could be going wrong here.

I want to say that the reason it is failing is because the zip files were not found, but you said you verified that they exist by printing their path to the log, right?  Are you doing this by calling the system.pathForFile() on your zip files?  That function will return nil if the zip file could not be found, which is the best way to verify if it is available.  Note that you are still expected to leave your zip file in your Corona project folder just like how you would do it for a Corona Simulator build.  If you put your zip files within the Android project’s “res” directory, then Corona will not be able to find it because a Corona ResourceDirectory accesses the APK’s “assets” directory and not it’s “res” directory.  (That part might be a little confusing, but it’s because this directory name matches iOS’ naming conventions.)

If you’re positive that your zip files can be found via system.pathForFile(), then I’ll have to redirect this issue to someone else here at Corona Labs that is more knowledgeable of this plugin.  I’ll do this today.

Hi Joshua,

I’m having the same problem running my game that I compiled using enterprise. It says that I’m missing zip.plugin. Where do I find the 3rd parties .so ?

ps : I’m still evaluating enterprise and using build 1202

thanks

yanuar,

Corona Enterprise does not include any plugin libraries.  You have to download them separately on our Corona Enterprise daily build page via the link below.  Also note that if you are a trial user (ie: you do not have an Enterprise subscription yet), then you do not have access to this webpage.  You should contact the person who provided you the Corona Enterprise trial for a copy of the plugins.

   http://developer.coronalabs.com/downloads/enterprise-daily-builds

Also note that you are no longer building with Corona anymore.  You are building with the Android SDK and you now must include/reference libraries into your Android application project according to Google’s documentation.  This means referencing an Android library project folder via the “project.properties” file or adding *.jar and *.so files to your project’s “libs” directory.  You only do one or the other for a single library.  The “project.properties” file is the preferred route if possible.  Corona Enterprise sample project “IncludeAllFeatures” demonstrates how to include the Facebook library via the “project.properties” and Flurry via the “libs” directory, which serves as a good example.

Also note that the “build.settings” file is ignored for native Android SDK builds.  That file is for Corona Simulator builds.  So, whatever you’re doing in your “build.settings” file, you’ll have to do the native Android way, such as adding permissions to your AndroidManifest.xml file yourself.  Corona’s “Icon-xhdpi.png” and other app icons are ignored for native Android builds as well since those are Corona Simulator build related files.  The native Android way of doing this is adding those files to the appropriate “res” directories and referencing them in your AndroidManifest.xml file.  All of this is documented on Google’s end.

Thanks Joshua,

Just got my license and plugins today but still having trouble with the plugins. Do I need to change anything in my lua to get the plugin?

I already set the project.properties to point at the plugin libs folder or put the .so in my libs folder but I still get this :

12-04 04:09:03.210 I/Corona  (6072):     no field package.preload[‘plugin.zip’]

12-04 04:09:03.210 I/Corona  (6072):     no file ‘(null)/plugin.zip.lua’

12-04 04:09:03.210 I/Corona  (6072):     no file ‘(null)/plugin.zip.lua’

12-04 04:09:03.210 I/Corona  (6072):     no file ‘/data/data/com.iplayalldaystudio.KQIPlayJoy/lib/libplugin.zip.so’

12-04 04:09:03.210 I/Corona  (6072):     no file ‘./plugin.zip.so’

12-04 04:09:03.210 I/Corona  (6072):     no file ‘(null)/plugin.zip.so’

12-04 04:09:03.210 I/Corona  (6072):     no file ‘/data/data/com.iplayalldaystudio.KQIPlayJoy/lib/libplugin.so’

12-04 04:09:03.210 I/Corona  (6072):     no file ‘./plugin.so’

12-04 04:09:03.210 I/Corona  (6072):     no file ‘(null)/plugin.so’

12-04 04:09:03.210 I/Corona  (6072): stack traceback:

12-04 04:09:03.210 I/Corona  (6072):     [C]: ?

12-04 04:09:03.210 I/Corona  (6072):     [C]: in function ‘require’

12-04 04:09:03.210 I/Corona  (6072):     ?: in function ‘require’

12-04 04:09:03.210 I/Corona  (6072):     ?: in main chunk

I’m suspicious about the way I call the plugin using “require” in my lua?

Thanks

I think you copied the *.so libraries to the wrong location since those are the libraries the application is failing to load.

*.jar files must be copied to the “libs” directory.

*.so files must be copied to the “libs/armeabi-v7a” directory.

Yup,

Sorry for asking, I realized that as soon as I posted this :slight_smile:

On a different note, the only that isn’t working from me regarding the zip plugin is that somehow I can’t find my unzipped files.

So, this is what happened :

  1. I have a zip file on my res, (it’s stored on assets)
  2. In my corona app, I unzip the file to the cache and document folder. This is supposed to work since I don’t get any error message from the zip plugin.
  3. The code where I read my files are no longer working, all saying unable to find files
  4. I dump the pathname for those files and they seems correct.

Check list :

  1. Already set the persmission to write_external_storage

  2. No error message from zip.uncompress

  3. I use these code to read files :

    local fullpath = system.pathForFile(fname, system.DocumentsDirectory) local hFile,err = io.open(fullpath ,“r”);  

My lua works just fine if I compiled using Pro 
Any ideas?

 

Hmm… I’m not sure what could be going wrong here.

I want to say that the reason it is failing is because the zip files were not found, but you said you verified that they exist by printing their path to the log, right?  Are you doing this by calling the system.pathForFile() on your zip files?  That function will return nil if the zip file could not be found, which is the best way to verify if it is available.  Note that you are still expected to leave your zip file in your Corona project folder just like how you would do it for a Corona Simulator build.  If you put your zip files within the Android project’s “res” directory, then Corona will not be able to find it because a Corona ResourceDirectory accesses the APK’s “assets” directory and not it’s “res” directory.  (That part might be a little confusing, but it’s because this directory name matches iOS’ naming conventions.)

If you’re positive that your zip files can be found via system.pathForFile(), then I’ll have to redirect this issue to someone else here at Corona Labs that is more knowledgeable of this plugin.  I’ll do this today.