@@ -1740,27 +1740,30 @@ int doPackage(Bundle* bundle)
17401740 // Write the R.java file into the appropriate class directory
17411741 // e.g. gen/com/foo/app/R.java
17421742 err = writeResourceSymbols (bundle, assets, assets->getPackage (), true );
1743- // If we have library files, we're going to write our R.java file into
1744- // the appropriate class directory for those libraries as well.
1745- // e.g. gen/com/foo/app/lib/R.java
1746- if (bundle->getExtraPackages () != NULL ) {
1747- // Split on colon
1748- String8 libs (bundle->getExtraPackages ());
1749- char * packageString = strtok (libs.lockBuffer (libs.length ()), " :" );
1750- while (packageString != NULL ) {
1751- // Write the R.java file out with the correct package name
1752- err = writeResourceSymbols (bundle, assets, String8 (packageString), true );
1753- packageString = strtok (NULL , " :" );
1754- }
1755- libs.unlockBuffer ();
1756- }
17571743 } else {
17581744 const String8 customPkg (bundle->getCustomPackage ());
17591745 err = writeResourceSymbols (bundle, assets, customPkg, true );
17601746 }
17611747 if (err < 0 ) {
17621748 goto bail;
17631749 }
1750+ // If we have library files, we're going to write our R.java file into
1751+ // the appropriate class directory for those libraries as well.
1752+ // e.g. gen/com/foo/app/lib/R.java
1753+ if (bundle->getExtraPackages () != NULL ) {
1754+ // Split on colon
1755+ String8 libs (bundle->getExtraPackages ());
1756+ char * packageString = strtok (libs.lockBuffer (libs.length ()), " :" );
1757+ while (packageString != NULL ) {
1758+ // Write the R.java file out with the correct package name
1759+ err = writeResourceSymbols (bundle, assets, String8 (packageString), true );
1760+ if (err < 0 ) {
1761+ goto bail;
1762+ }
1763+ packageString = strtok (NULL , " :" );
1764+ }
1765+ libs.unlockBuffer ();
1766+ }
17641767 } else {
17651768 err = writeResourceSymbols (bundle, assets, assets->getPackage (), false );
17661769 if (err < 0 ) {
0 commit comments