[ https://issues.apache.org/jira/browse/CB-5143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Braden Shepherdson resolved CB-5143. ------------------------------------ Resolution: Fixed Assignee: Braden Shepherdson (was: Lorin Beer) > CLI cordova prepare fails to copy the common files to android platform > ---------------------------------------------------------------------- > > Key: CB-5143 > URL: https://issues.apache.org/jira/browse/CB-5143 > Project: Apache Cordova > Issue Type: Bug > Components: Android, CLI > Affects Versions: 3.1.0 > Environment: Windows > Reporter: Peter > Assignee: Braden Shepherdson > Priority: Blocker > > I had created a CLI project, and then used CLI to add the android platform > and add many plugins, etc. > Then I used *cordova prepare* to copy my "common" www files to the android > platform folders. This step worked OK for the simple _HelloWorld_ example > from the CLI online guide, but for my full CLI project the prepare did not > copy anything. The prepare processed the plugins OK, but nothing copied, and > there was no error or any other indication what went wrong. (The -d debug > flag did not help much either) > Eventually, after consuming a lot of coffee the problem was isolated to a > file called _android_parser.js_ which executes during the cordova prepare > processing. > This code... > {code} > var orig_java_class = fs.readdirSync(orig_pkgDir).filter(function(f) {return > f.indexOf('.svn') == -1;})[0]; > {code} > is apparently assuming that the main app java class is the _only_ (or > _first_?) file found in the package directory. But this assumption is > incorrect for my project (e.g. there are other sub-packages which were found > ahead of the .java file) and so the script was failing shortly after this > line of code, resulting in no copy... :( > For example, my project structure resembles > {code} > src > \-- com > \-- fujitsu > \-- mypkg > \-- apkg1 > \-- bpkg2 > MyApp.java > \-- zpkg3 > {code} > To get arround this issue I am currently using using a hacky workaround - > renaming the app java file with a prefix "AAA_" so that at least the zero > offset can find it OK. > {code} > src > \-- com > \-- fujitsu > \-- mypkg > AAA_MyApp.java > \-- apkg1 > \-- bpkg2 > \-- zpkg3 > {code} > With this hack in place the cordova prepare copies the common files as > expected. > BTW - In fact I don't even use this file at all because my > _AndroidManifest.xml_ is manually configured to launch a completely different > main activity. But I have to leave this dummy AAA_MyApp.java file lying > around just so the CLI cordova prepare will behave properly. If not for this > issue then I would just delete it. -- This message was sent by Atlassian JIRA (v6.1#6144)