{ "id": "108771", "key": "TIMOB-13696", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "15699", "description": "2013 Sprint 21", "name": "2013 Sprint 21", "archived": true, "released": true, "releaseDate": "2013-10-18" }, { "id": "15701", "description": "2013 Sprint 21 Core", "name": "2013 Sprint 21 Core", "archived": true, "released": true, "releaseDate": "2013-10-18" }, { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-10-19T01:23:13.000+0000", "created": "2013-01-29T18:57:58.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "androidbuild", "cb-verified" ], "versions": [], "issuelinks": [], "assignee": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "updated": "2013-11-19T01:18:12.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" }, { "id": "10207", "name": "Tooling" } ], "description": "*Problem description*\r\nWhen building a module example app with the above environment, I see that libstlport_shared.so is copied to my libs/\\[armeabi|armeabi-v7a|x86\\] directory. The android/builder.py script adds another copy of this library to the unsigned APK file (see line 1638-1640) which causes the jarsigner step to fail with the following error:\r\n\r\n{code}\r\n[exec] [DEBUG] installing native lib: /var/folders/3s/15_hswz52w1b42_wmj_f57c40000gq/T/mvmPeWYti/titouchdb/modules/android/com.obscure.titouchdb/0.5/libs/x86/libstlport_shared.so\r\n[exec] [DEBUG] installing native SDK libs\r\n[exec] [DEBUG] keytool -v -list -keystore \"/Users/paul/Library/Application Support/Titanium/mobilesdk/osx/3.1.0.GA/android/dev_keystore\" -storepass ******* -alias tidev\r\n[exec] [DEBUG] jarsigner -sigalg MD5withRSA -digestalg SHA1 -storepass ******* -keystore \"/Users/paul/Library/Application Support/Titanium/mobilesdk/osx/3.1.0.GA/android/dev_keystore\" -signedjar /var/folders/3s/15_hswz52w1b42_wmj_f57c40000gq/T/mvmPeWYti/titouchdb/build/android/bin/app.apk /var/folders/3s/15_hswz52w1b42_wmj_f57c40000gq/T/mvmPeWYti/titouchdb/build/android/bin/app-unsigned.apk tidev\r\n[exec] [ERROR] unable to sign jar: java.util.zip.ZipException: duplicate entry: lib/armeabi/libstlport_shared.so\r\n[exec] [ERROR] Build Failed.\r\n{code}\r\n\r\n*Workaround*\r\nChange android/builder.py so it doesn't add libstlport_shared.so to the APK.\r\n\r\nCurrently, at lines 1705-1706, the file reads:\r\n\r\n{code:python}\r\nfor fname in ('libkroll-v8.so', 'libstlport_shared.so'):\r\n apk_zip.write(os.path.join(lib_source_dir, fname), lib_dest_dir + fname)\r\n{code}\r\n\r\nIf I replace those two lines with the following code, I no longer see the build error:\r\n{code:python}\r\napk_zip.write(os.path.join(lib_source_dir, 'libkroll-v8.so'), lib_dest_dir + 'libkroll-v8.so')\r\n{code}", "attachment": [], "flagged": false, "summary": "Android: duplicate entry in signed APK for libstlport_shared.so", "creator": { "name": "pegli", "key": "pegli", "displayName": "Paul Mietz Egli", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "pegli", "key": "pegli", "displayName": "Paul Mietz Egli", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Ti 3.0.0.GA, Android SDK r21.0.1, Android NDK r8d", "comment": { "comments": [ { "id": "249211", "author": { "name": "pegli", "key": "pegli", "displayName": "Paul Mietz Egli", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Still an issue in 3.1.0.GA.", "updateAuthor": { "name": "pegli", "key": "pegli", "displayName": "Paul Mietz Egli", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-04-26T22:35:27.000+0000", "updated": "2013-04-26T22:35:27.000+0000" }, { "id": "249218", "author": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Paul,\n\nIt would help our engineering team to resolve the issue faster if you could provide the error message of \"causes the jarsigner step to fail\", and also a \"before and after\" code extract from builder.py.\n\nThanks!", "updateAuthor": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-04-26T22:50:43.000+0000", "updated": "2013-04-26T22:50:43.000+0000" }, { "id": "249240", "author": { "name": "pegli", "key": "pegli", "displayName": "Paul Mietz Egli", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Here's the end of the build log for {{ant run}}\n\n{code:none}\n\n [exec] [DEBUG] installing native lib: /var/folders/3s/15_hswz52w1b42_wmj_f57c40000gq/T/mvmPeWYti/titouchdb/modules/android/com.obscure.titouchdb/0.5/libs/x86/libstlport_shared.so\n [exec] [DEBUG] installing native SDK libs\n [exec] [DEBUG] keytool -v -list -keystore \"/Users/paul/Library/Application Support/Titanium/mobilesdk/osx/3.1.0.GA/android/dev_keystore\" -storepass ******* -alias tidev\n [exec] [DEBUG] jarsigner -sigalg MD5withRSA -digestalg SHA1 -storepass ******* -keystore \"/Users/paul/Library/Application Support/Titanium/mobilesdk/osx/3.1.0.GA/android/dev_keystore\" -signedjar /var/folders/3s/15_hswz52w1b42_wmj_f57c40000gq/T/mvmPeWYti/titouchdb/build/android/bin/app.apk /var/folders/3s/15_hswz52w1b42_wmj_f57c40000gq/T/mvmPeWYti/titouchdb/build/android/bin/app-unsigned.apk tidev\n [exec] [ERROR] unable to sign jar: java.util.zip.ZipException: duplicate entry: lib/armeabi/libstlport_shared.so\n [exec] [ERROR] Build Failed.\n{code}\n\nThe change in builder.py is at lines 1705-1706. Currently, the file reads:\n\n{code:python}\nfor fname in ('libkroll-v8.so', 'libstlport_shared.so'):\n apk_zip.write(os.path.join(lib_source_dir, fname), lib_dest_dir + fname)\n{code}\n\nIf I replace those two lines with the following code, I no longer see the build error:\n\n{code:python}\napk_zip.write(os.path.join(lib_source_dir, 'libkroll-v8.so'), lib_dest_dir + 'libkroll-v8.so')\n{code}\n\nPlease let me know if you need any additional information.", "updateAuthor": { "name": "pegli", "key": "pegli", "displayName": "Paul Mietz Egli", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-04-26T23:32:44.000+0000", "updated": "2013-04-26T23:32:44.000+0000" }, { "id": "249638", "author": { "name": "pegli", "key": "pegli", "displayName": "Paul Mietz Egli", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I've gotten a little farther along on this bug. My module contains a C++ native library. During the build process, the NDK is copying a version of libstlport_shared.so from the NDK directory into my libs/{ARCH} folder, which is then being included in the APK zip by builder.py line 1684 and/or 1687. When I modified builder.py as shown above, I no longer got the build error due to multiple copies of the libstlport_shared.so file in the APK, but I saw linker errors when deploying to the emulator:\r\n\r\n{code:none}\r\nI/dalvikvm( 291): Unable to dlopen(/data/data/com.obscure.titouchdb/lib/libkroll-v8.so): Cannot load library: \r\nlink_image[1995]: failed to link libkroll-v8.so\r\n{code}\r\n\r\nThis made me suspect that the problem is an incompatibility between libkroll-v8 and the version of libstlport_shared that came from the NDK. I changed line 1682-84 from this:\r\n\r\n{code:python}\r\nfor module in self.modules:\r\n\texclude_libs = []\r\n\tadd_native_libs(module.get_resource('libs'), exclude_libs)\r\n{code}\r\n\r\nto this:\r\n\r\n\r\n{code:python}\r\nfor module in self.modules:\r\n\texclude_libs = ['libstlport_shared.so']\r\n\tadd_native_libs(module.get_resource('libs'), exclude_libs)\r\n{code}\r\n\r\nand changed line 1687 from this:\r\n\r\n{code:python}\r\nadd_native_libs(os.path.join(self.project_dir, 'libs'))\r\n{code}\r\n\r\nto this:\r\n\r\n{code:python}\r\nadd_native_libs(os.path.join(self.project_dir, 'libs'), ['libstlport_shared.so'])\r\n{code}\r\n\r\nThis appears to have fixed the problem. My module's example project now runs on both an armeabi and an x86 emulator image.", "updateAuthor": { "name": "pegli", "key": "pegli", "displayName": "Paul Mietz Egli", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-05-01T00:04:49.000+0000", "updated": "2013-05-01T00:04:49.000+0000" }, { "id": "254021", "author": { "name": "nino168", "key": "nino168", "displayName": "Martino Harjono", "active": true, "timeZone": "Asia/Jakarta" }, "body": "Yeah, I'm experiencing the same problem.\r\nAnd thanks to Paul for the resolution. I owe you man ;)", "updateAuthor": { "name": "nino168", "key": "nino168", "displayName": "Martino Harjono", "active": true, "timeZone": "Asia/Jakarta" }, "created": "2013-05-26T09:13:10.000+0000", "updated": "2013-05-26T09:13:10.000+0000" }, { "id": "262343", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "We are trying to reproduce this issue. Could someone please create a test project that demonstrates the issue including any native modules needed? Thank you!", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2013-07-18T16:56:40.000+0000", "updated": "2013-07-18T16:56:40.000+0000" }, { "id": "262570", "author": { "name": "cbrensinger", "key": "cbrensinger", "displayName": "Charlie Brensinger", "active": true, "timeZone": "Europe/London" }, "body": "I'm running into this issue with a fresh project. I've uploaded a zip of the project here: http://db.tt/7HngLsJu and the only modules I'm loading in are titouchdb (https://pegli.github.s3.amazonaws.com/com.obscure.titouchdb-android-0.9.zip and https://pegli.github.s3.amazonaws.com/com.obscure.titouchdb-iphone-0.9.zip). I've loaded those directly into Titanium and included them (should be reflected in tiapp.xml).", "updateAuthor": { "name": "cbrensinger", "key": "cbrensinger", "displayName": "Charlie Brensinger", "active": true, "timeZone": "Europe/London" }, "created": "2013-07-20T22:55:36.000+0000", "updated": "2013-07-20T22:55:36.000+0000" }, { "id": "275820", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/4781", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-19T01:23:13.000+0000", "updated": "2013-10-19T01:23:13.000+0000" }, { "id": "280110", "author": { "name": "lokeshchdhry", "key": "lokeshchdhry", "displayName": "Lokesh Choudhary", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix with the attached app & modules.The \"libstplport_shared.so\" file is only copied one time & the packaging is successfull.\r\nClosing.\r\n\r\nEnvironment:\r\nAppcel Studio : 3.2.0.201311161724\r\nTi SDK : 3.2.0.v20131117001643\r\nMac OSX : 10.8.5\r\nAlloy : 1.3.0\r\nCLI - 3.2.0-alpha\r\nDevice: Samsung Galaxy S4 running android 4.2.2", "updateAuthor": { "name": "lokeshchdhry", "key": "lokeshchdhry", "displayName": "Lokesh Choudhary", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-11-19T01:18:12.000+0000", "updated": "2013-11-19T01:18:12.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }