Note that there are some explanatory texts on larger screens.

plurals
  1. POBuilding android apk with ant under MacOS X and "Application not installed"
    primarykey
    data
    text
    <p>I have a bash script that basically calls ant to compile a Android application source tree, and then uses adb to install and start the application on a connected android device.</p> <p>The bash script has many options, but it basically edits AndroidManifest.xml and strings.xml to change the package and the app name, then issues "android update project ." and finally "ant release". Here is the relevant snippet:</p> <pre><code>if [ "$NEWPACKAGENAME" != "" ] ; then echo &gt;&gt; AndroidManifest.xml # the loop below looses the last line, # so we ensure that's a useless line cat AndroidManifest.xml | ( while read ROW ; do IS_PACKAGE_ROW=`echo $ROW | grep 'package=' | wc -l` ; if [ $IS_PACKAGE_ROW -gt 0 ] ; then echo " package=\"$NEWPACKAGENAME\"" &gt;&gt; AndroidManifest-np.xml else echo "$ROW" &gt;&gt; AndroidManifest-np.xml fi ; done ) mv AndroidManifest-np.xml AndroidManifest.xml fi if [ "$APPNAME" != "" ] ; then echo &gt;&gt; res/values/strings.xml # the loop below looses the last line, # so we ensure that's a useless line cat res/values/strings.xml | ( while read ROW ; do IS_NAME_ROW=`echo $ROW | grep '&lt;string name="app_name"&gt;' | wc -l` ; if [ $IS_NAME_ROW -gt 0 ] ; then echo "&lt;string name=\"app_name\"&gt;$APPNAME&lt;/string&gt;" &gt;&gt; res/values/strings-nn.xml else echo "$ROW" &gt;&gt; res/values/strings-nn.xml fi ; done ) mv res/values/strings-nn.xml res/values/strings.xml fi rm -f bin/*.ap_* bin/*.apk* $ANDROID update project -p . $ANT release </code></pre> <p>The script works great under GNU/Linux, it creates the apk file, it installs the file via adb, and the same apk file can be installed manually on the device by copying or downloading it to the device (Unknown sources in developers options obviously already active).</p> <p>However under MacOS X it has a problem: the resulting apk file works only if installed via "adb install" (run by the script itself or by hand). If I try to manually copy or download the apk file to a Android device, I mean the apk file generated by the script when run under MacOSX, the device asks usual confirmations but then says "Application not installed".</p> <p>I've already read a few questions about the "Application not installed" problem, the replies seem to point in the AndroidManifest.xml direction (duplicate activity and the like) but I fail to understand how that can be the problem in my case, since the script is just the same that works under Linux and since it does work also under MacOS X when issuing the "adb install" command itself (so the apk has to be valid).</p> <p>Other things already tried/verified:</p> <ul> <li>removing the app from the device before trying to install the new version</li> <li>the signing key is always the same and not the debug one (however the device complains earlier in case I use different signatures) </li> <li>downloading the apk from http or as mail attachment </li> <li>dancing around the tablet with ancestral movements while trying to install...</li> </ul> <p>The 4th worked once (to my surprise). But just once, then never again. I don't know what I did different that time, ancestral dances apart. Ah yes, I had removed completely unrelated applications before installing it... removed a number of them. Needless to say, removing unrelated applications didn't help other times. Besides I never reinstalled them again...</p> <p>Any suggestions?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload