[TIMOB-2115] Android SDK build errors under win32
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:58:08.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.5.0 M01 |
Components | Android |
Labels | android, build, defect, win32 |
Reporter | Robby |
Assignee | Marshall Culpepper |
Created | 2011-04-15T03:10:49.000+0000 |
Updated | 2011-04-17T01:58:08.000+0000 |
Description
Just a few bugs I've noticed while trying to get 1.5.x's Android SDK modules to work under windows.
#0. exception is generated in a fork() call when trying to create a new module template using titanium.py ...you have to call module.py with the args directly instead
#1.
you have a bug with manifest.py (line 18) under windows...you're
splitting on ":"...breaks on android.sdk, as under windows mine is
C:\progra~1\android-sdk Obvious fix: change to:
key,value = line.split(':', 1)
#2. for some reason I have my module being added to self.module_jars in builder.py twice (looks like detector.find_app_modules() is finding it twice... same exact path, just in the list twice, which causes the build command to fail). I monkeyhacked this to just get around it by doing:
for module in modules:
if module.path not in self.module_jars:
self.module_jars.append(module.path)
classpath = os.pathsep.join([classpath, module.path])
#3. After this, using require() still fails for me (I'm missing something obvious I bet). However, using Ti.moduleName works. So, I'll go with that for now! :)
#4. my module requires some 3rd party libs (jars), such as google-api-client-1.1.1-alpha.jar. Placing them in /lib allows them to be resolved at compile time and my module to build successfully. However, I get a NoClassDefFoundError at runtime when anything from any of the modules are hit in the code. I've tried placing the jars in my app's build/android/lib and in /android to no avail.
Robby. When entering tags, make sure to use commas between them. I've corrected the tags.
Sorry about that Don. I've updated the ticket with one more potential bug I ran into on advice from Marshall.
Robby, no worries. But if I don't mention it, it never changes :)
(from [49f154a370ef55ba293d2d8d547eb5c79fe57626]) a new batch script frontend for titanium.py in windows, make sure to pass on the sys.executable when calling other python scripts, and only split manifest entries on the first colon [#2115] http://github.com/appcelerator/titanium_mobile/commit/49f154a370ef55ba293d2d8d547eb5c79fe57626"> http://github.com/appcelerator/titanium_mobile/commit/49f154a370ef5...
(from [19571872de8164acdcb364fb4dbba0b53f110682]) more win32 fixes: use new manifest module in titanium.py, call python from the module builder, use titanium.bat in the project build.xml, and ant.bat from the module builder. give an error if the platform/google apis aren't found [#2115] http://github.com/appcelerator/titanium_mobile/commit/19571872de8164acdcb364fb4dbba0b53f110682"> http://github.com/appcelerator/titanium_mobile/commit/19571872de816...
(from [05fcb7c95be28861649eea68c9eb674bd542a4c1]) yet more win32 fixes: chop off the file:\ prefix in the annotation generator so binding JSON data gets reloaded on subsequent annotation rounds. any jar files in lib are now expanded into the top level module jar in the dist target so they are always distributed with the module jar. changed ant script to use build/classes for building to not conflict with JDT's bin folder, and made sure the run and run.emulator targets depend on the dist target [#2115] http://github.com/appcelerator/titanium_mobile/commit/05fcb7c95be28861649eea68c9eb674bd542a4c1"> http://github.com/appcelerator/titanium_mobile/commit/05fcb7c95be28...
OK, at this point #0, #1, and #4 look to be solved from my testing in XP. Some follow up questions:
#2: Did you accidentally copy your module into the system folder as well as the application folder? If so the detector will pick it up twice. Would you mind posting the full trace log so I can try to reproduce the error?
#3: require() works like a charm for me in both XP and OSX.. Some things to check: - Is the ID in require() the same as the ID in your @Kroll.module declaration? - Did the 3rd party JAR error from #4 cause your module class to fail loading?
Have you tried taking a look at the "example" folder that gets generated? You can run that app.js by calling ant run.emulator / ant run to test it out.
Marshall,
Not strictly related to this ticket but looks like there is a scons problem too. See http://developer.appcelerator.com/helpdesk/view/50451">Helpdesk 50451
Hey Marshall,
This is great. Regarding #2...I did check for extra copies of my jar...there don't seem to be any. The build trace is at http://pastebin.com/U5qB0jhp">http://pastebin.com/U5qB0jhp . You'll notice at line 564, it's finding the jar in the same place twice (with the same name). This is unmodified from I think the 10/19 build, grabbed after you made the comitt that fixed 0, 1, and 4.
I'll try this (and using require()) in the newest build, as I see you've made even more android module changes.
Cool thanks for the info. You'll probably want to recreate your project after updating, I've made a number of build and distribution changes that are incompatible with projects from a few days ago, FYI
Marshall,
Recreated the project as you said. That all goes well. With the new build.xml, there is one minor regression upon building:
My {build} path has a space in it (sits in My Documents), which ant doesn't seem to like:
As a temp workaround (and because I know very little about how ant works), I placed the following in my build.properties:
Which fixes the problem.
Another bug:
from one of the 20101025 daily builds, in module\module.py, around line 184:
"if platform_dir in ['osx', 'win32', 'linux']:" should be "if platform in ['osx', 'win32', 'linux']:" instead.
With the current code, the module searcher is looking into desktop platform module dirs (e.g. 'win32') in my case.
And it still appears that for me at least it's finding modules twice:
(see the end of that string...my custom modules it finds twice, at the same exact directories.) Looking there everything looks fine at least to me...the files are only there once.
(from [27039690045edf352854e05b2dd06beb03551185]) use compilerarg "value" so the .apt_generated path gets properly escaped, check platform instead of platform_dir when looking at module directories [#2115] http://github.com/appcelerator/titanium_mobile/commit/27039690045edf352854e05b2dd06beb03551185"> http://github.com/appcelerator/titanium_mobile/commit/27039690045ed...
Robby, would you be able to spend some time with me on IRC today to see if we can make sure all these are fixed?
Thanks Opie! verified Windows
This is broken again in 1.5.1 final: The build process with a custom module fails for me because it is finding the modules twice.
(You'll notice that the calendarlib.jar, google-api-client and jackson-core jars are included twice...from the same exact dir.)
This causes build errors like:
Fixed it by monkeypatching android/builder.py:
@Robby would you mind opening a different ticket for this new problem? Assign it to me and I'll get it scheduled in. Also if you'd like to contribute an actual patch we just need you to sign the CLA.