Problem Description
I create Titanium Mobile Module project using studio. And try to make it. Got an error.
Actual Results
The default module is not building just out of the box
Expected Results
The default module compiling without any issues.
Test Case
1. Create a new mobile module for Android.
2. Set NDK
3. Build
Extra info
When compiling the module, you got this:
Buildfile: build.xml
init:
process.annotations:
generate.rhino.bindings:
[java] java.util.zip.ZipException: error in opening zip file
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:194)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:764)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:218)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:132)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:105)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[java] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[java] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:394)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[java] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.Target.execute(Target.java:357)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
[java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
[java] at org.apache.tools.ant.Main.runBuild(Main.java:758)
[java] at org.apache.tools.ant.Main.startAnt(Main.java:217)
[java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
[java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
[java] Caused by: java.util.zip.ZipException: error in opening zip file
[java] at java.util.zip.ZipFile.open(Native Method)
[java] at java.util.zip.ZipFile.<init>(ZipFile.java:127)
[java] at java.util.jar.JarFile.<init>(JarFile.java:135)
[java] at java.util.jar.JarFile.<init>(JarFile.java:99)
[java] at org.appcelerator.kroll.annotations.generator.KrollBindingGenerator.loadTitaniumBindings(KrollBindingGenerator.java:285)
[java] at org.appcelerator.kroll.annotations.generator.KrollBindingGenerator.main(KrollBindingGenerator.java:391)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
[java] ... 34 more
[java] --- Nested Exception ---
[java] java.util.zip.ZipException: error in opening zip file
[java] at java.util.zip.ZipFile.open(Native Method)
[java] at java.util.zip.ZipFile.<init>(ZipFile.java:127)
[java] at java.util.jar.JarFile.<init>(JarFile.java:135)
[java] at java.util.jar.JarFile.<init>(JarFile.java:99)
[java] at org.appcelerator.kroll.annotations.generator.KrollBindingGenerator.loadTitaniumBindings(KrollBindingGenerator.java:285)
[java] at org.appcelerator.kroll.annotations.generator.KrollBindingGenerator.main(KrollBindingGenerator.java:391)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:764)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:218)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:132)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:105)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[java] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[java] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:394)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[java] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.Target.execute(Target.java:357)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
[java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
[java] at org.apache.tools.ant.Main.runBuild(Main.java:758)
[java] at org.apache.tools.ant.Main.startAnt(Main.java:217)
[java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
[java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
[java] Java Result: -1
generate.rhino.idswitch:
[echo] Generating IDs for /media/additional/projects/app_celertor_work_space/android_module/build/generated/java/module_id/AndroidModuleBootstrap.java
generate.v8.bindings:
[java] java.util.zip.ZipException: error in opening zip file
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:194)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:764)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:218)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:132)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:105)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[java] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[java] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:394)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[java] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.Target.execute(Target.java:357)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
[java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
[java] at org.apache.tools.ant.Main.runBuild(Main.java:758)
[java] at org.apache.tools.ant.Main.startAnt(Main.java:217)
[java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
[java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
[java] Caused by: java.util.zip.ZipException: error in opening zip file
[java] at java.util.zip.ZipFile.open(Native Method)
[java] at java.util.zip.ZipFile.<init>(ZipFile.java:127)
[java] at java.util.jar.JarFile.<init>(JarFile.java:135)
[java] at java.util.jar.JarFile.<init>(JarFile.java:99)
[java] at org.appcelerator.kroll.annotations.generator.KrollBindingGenerator.loadTitaniumBindings(KrollBindingGenerator.java:285)
[java] at org.appcelerator.kroll.annotations.generator.KrollBindingGenerator.main(KrollBindingGenerator.java:391)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
[java] ... 34 more
[java] --- Nested Exception ---
[java] java.util.zip.ZipException: error in opening zip file
[java] at java.util.zip.ZipFile.open(Native Method)
[java] at java.util.zip.ZipFile.<init>(ZipFile.java:127)
[java] at java.util.jar.JarFile.<init>(JarFile.java:135)
[java] at java.util.jar.JarFile.<init>(JarFile.java:99)
[java] at org.appcelerator.kroll.annotations.generator.KrollBindingGenerator.loadTitaniumBindings(KrollBindingGenerator.java:285)
[java] at org.appcelerator.kroll.annotations.generator.KrollBindingGenerator.main(KrollBindingGenerator.java:391)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:764)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:218)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:132)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:105)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[java] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[java] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:394)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[java] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.Target.execute(Target.java:357)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
[java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
[java] at org.apache.tools.ant.Main.runBuild(Main.java:758)
[java] at org.apache.tools.ant.Main.startAnt(Main.java:217)
[java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
[java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
[java] Java Result: -1
generate.bindings:
pre.compile:
ndk.build:
[exec] jni/Android.mk:24: warning: overriding commands for target /media/additional/projects/app_celertor_work_space/android_module/build/generated/KrollGeneratedBindings.cpp'
[exec] jni/Android.mk:24: warning: ignoring old commands for target
/media/additional/projects/app_celertor_work_space/android_module/build/generated/KrollGeneratedBindings.cpp'
[exec] jni/Android.mk:27: warning: overriding commands for target /media/additional/projects/app_celertor_work_space/android_module/build/generated/BootstrapJS.cpp'
[exec] jni/Android.mk:27: warning: ignoring old commands for target
/media/additional/projects/app_celertor_work_space/android_module/build/generated/BootstrapJS.cpp'
[exec] Compile++ thumb : module_id <= AndroidModuleBootstrap.cpp
[exec] In file included from jni/../AndroidModuleBootstrap.cpp:17:
[exec] /media/additional/projects/app_celertor_work_space/android_module/build/generated/KrollGeneratedBindings.gperf:9:36: error: module_id.ExampleProxy.h: No such file or directory
[exec] /media/additional/projects/app_celertor_work_space/android_module/build/generated/KrollGeneratedBindings.gperf:10:43: error: module_id.AndroidModuleModule.h: No such file or directory
[exec] In file included from jni/../AndroidModuleBootstrap.cpp:17:
[exec] /media/additional/projects/app_celertor_work_space/android_module/build/generated/KrollGeneratedBindings.gperf:14: warning: declaration 'struct titanium::bindings::BindEntry' does not declare anything
[exec] In file included from jni/../AndroidModuleBootstrap.cpp:17:
[exec] /media/additional/projects/app_celertor_work_space/android_module/build/generated/KrollGeneratedBindings.gperf: In static member function 'static titanium::bindings::BindEntry* AndroidModuleBindings::lookupGeneratedInit(const char*, unsigned int)':
[exec] /media/additional/projects/app_celertor_work_space/android_module/build/generated/KrollGeneratedBindings.gperf:16: error: '::module_id' has not been declared
[exec] /media/additional/projects/app_celertor_work_space/android_module/build/generated/KrollGeneratedBindings.gperf:16: error: '::module_id' has not been declared
[exec] In file included from jni/../AndroidModuleBootstrap.cpp:17:
[exec] /media/additional/projects/app_celertor_work_space/android_module/build/generated/KrollGeneratedBindings.gperf:17: error: '::module_id' has not been declared
[exec] /media/additional/projects/app_celertor_work_space/android_module/build/generated/KrollGeneratedBindings.gperf:17: error: '::module_id' has not been declared
[exec] /media/additional/projects/app_celertor_work_space/android_module/build/generated/KrollGeneratedBindings.gperf:18: error: too many initializers for 'titanium::bindings::BindEntry'
[exec] /media/additional/projects/app_celertor_work_space/android_module/build/generated/KrollGeneratedBindings.gperf:18: error: too many initializers for 'titanium::bindings::BindEntry'
[exec] make: *** [/media/additional/projects/app_celertor_work_space/android_module/build/generated/obj/local/armeabi/objs/module_id/__/AndroidModuleBootstrap.o] Error 1
BUILD FAILED
/home/dima/.titanium/mobilesdk/linux/2.0.1.GA2/module/android/build.xml:228: exec returned: 2
Total time: 1 second
Workaround
1. After creating your module, if you don't rename your Workspace to something without spaces, you will need to move your project to a directory without spaces.
2. Once you moved it, just type: ant and will automatically build. Right now, with Ti Studio, I created a new module, edit the build.properties to add the ndk:
titanium.platform=/Library/Application Support/Titanium/mobilesdk/osx/2.0.1.GA2/android
android.platform=/Users/mpmiranda/Downloads/android-sdk-macosx/platforms/android-8
google.apis=/Users/mpmiranda/Downloads/android-sdk-macosx/add-ons/addon-google_apis-google_inc_-8
android.ndk=/Users/mpmiranda/Downloads/android-ndk-r7c
and then, move it to my Desktop directory, then just run ant and works just fine.
Shack, We are making deсision what to choose: appcelerator or android sdk to implement our projects. This functional is critical for us. It will make our choise. Could you give any comments on this error?
Dmitriy, this is a valid bug, I will move it to mobile, but there is a workaround here: 1. After creating your module, if you don't rename your Workspace to something without spaces, you will need to move your project to a directory without spaces. 2. Once you moved it, just type: ant and will automatically build. Right now, with Ti Studio, I created a new module, edit the build.properties to add the ndk:
and then, move it to my Desktop directory, then just run ant and works just fine. In order to learn more about this, you can try the guide: https://wiki.appcelerator.org/display/tis/Creating+a+New+Titanium+Module more focused on android: http://developer.appcelerator.com/doc/mobile/android/module_sdk The full mod dev guide: https://github.com/appcelerator/titanium_modules/tree/master/moddevguide/mobile BEst, Mauro
Mauro, still not working. I created module in studio with workspace /media/additional/projects/app_celertor_work_space2. There is no spaces. Run ant. I got the same error. Copy module to media/additional/mod dir. Run ant - same resutl. Or should I copy module to my Desktop dir? But my desctop dir name is 'Рабочий стол'. My build.properties
Hello, this is weird. Let me find an ubuntu machine in order to reproduce this. Best, Mauro
PR pending https://github.com/appcelerator/titanium_mobile/pull/2261 The following wiki section should be updated after the PR submitted: https://wiki.appcelerator.org/display/tis/Creating+a+New+Titanium+Module#CreatingaNewTitaniumModule-ForAndroidModuleDevelopment
Closing ticket as fixed.