Cannot install app built on CLI, outside Android Studio – “failed to delete” errors/base.apk code missing



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm quite new to Android native development and lately experimenting with building directly from CLI without Android Studio (really don't like the IDE and find Gradle overly complex, although I can't get my toolchain running yet...)



Using guidance from around the web, particularly this, I have a extremely basic app which successfully builds to a signed and aligned APK (as far as I can tell). I am building against platform 14 with Java 1.8 and I observed no changes when altering this configuration.



I've put the app source on GitHub for reference for this question. It's one activity with one layout.



When it comes to adb install (or manually install from the device), installation always fails with INSTALL_FAILED_INVALID_APK... Package /data/app/net.ilmiont.helloworld-...==/base.apk code is missing (... is some long ID by appearances).



Logcat



Running adb logcat during the installation attempt, I get this:



11-16 10:34:52.729 24742 7402 I Finsky : [9791] com.google.android.finsky.verifier.impl.ea.a(82): Skipping verification. Disabled by user setting
11-16 10:34:52.729 24742 7402 I Finsky : [9791] com.google.android.finsky.verifier.impl.ea.a(43): Skipping anti malware verification due to pre-check failure
11-16 10:34:52.730 24742 24742 I Finsky : [2] com.google.android.finsky.verifier.impl.fs.c(164): Verifying id=132, result=1
11-16 10:34:52.735 24742 24742 I Finsky : [2] com.google.android.finsky.verifier.impl.fs.c(177): Verification complete: id=132, package_name=net.ilmiont.helloworld
11-16 10:34:52.752 1856 27782 E : Couldn't opendir /data/data/net.ilmiont.helloworld: No such file or directory
11-16 10:34:52.753 1856 27782 E installd: Failed to delete /data/data/net.ilmiont.helloworld: No such file or directory
11-16 10:34:52.753 1856 27782 E : Couldn't opendir /data/user_de/0/net.ilmiont.helloworld: No such file or directory
11-16 10:34:52.753 1856 27782 E installd: Failed to delete /data/user_de/0/net.ilmiont.helloworld: No such file or directory
11-16 10:34:52.754 2198 2398 W PackageManager: com.android.server.pm.Installer$InstallerException: android.os.ServiceSpecificException: Failed to delete /data/user_de/0/net.ilmiont.helloworld (code 2)
11-16 10:34:52.756 2198 2398 W PackageManager: Package couldn't be installed in /data/app/net.ilmiont.helloworld-pbDVHiVe6mEghhiOqRUNjg==
11-16 10:34:52.756 2198 2398 W PackageManager: com.android.server.pm.PackageManagerException: Package /data/app/net.ilmiont.helloworld-pbDVHiVe6mEghhiOqRUNjg==/base.apk code is missing



I do not understand why it is trying to open/delete these directories when the app is just getting installed (and has not ever successfully installed) --- I don't know enough about Android internals, but from that trace it does look like the deletion is the problem.



I've looked over my source multiple times and just can't see what I'm missing. The manifest looks OK, the layout looks OK, the Java is all of two lines. So what am I missing? It must be something glaringly obvious.



The device



This may be relevant, so here are all the details.



Nokia 6 (original one) running unrooted Android 8.1.



I opened Android Studio, created the default boilerplate app and hit "Run", and it built and deployed successfully, so clearly there is something wrong with my app/build toolchain which is making this break, and I've out of ideas of where to look.



The build script (excerpts, it does build but will not deploy)



aapt package -v -f -m -J $PROJECT_SOURCE -M $ANDROID_MANIFEST -S $ANDROID_RESOURCES -I $ANDROID_SDK/platforms/android-$ANDROID_API/android.jar;



javac -d $JAVA_COMPILE_DESTINATION -source $JAVA_VERSION -target $JAVA_VERSION_TARGET -classpath "$PROJECT_SOURCE$JAVA_CLASSPATH_LIBS" -bootclasspath $ANDROID_SDK/platforms/android-$ANDROID_API/android.jar $PROJECT_SOURCE/$PROJECT_PACKAGE_SOURCE/*.java;



dx --dex --output=$DX_COMPILE_DESTINATION $JAVA_COMPILE_DESTINATION;



aapt package -f -m -F $APP_APK_UNALIGNED -M $ANDROID_MANIFEST -S $ANDROID_RESOURCES -I $ANDROID_SDK/platforms/android-$ANDROID_API/android.jar;



aapt add $APP_APK_UNALIGNED $DX_COMPILE_DESTINATION;



zipalign -f 4 $APP_APK_UNALIGNED $APP_APK;



apksigner sign --ks /home/jh_walker/.keystore $APP_APK;



Keystore



keytool -genkeypair -validity 365 -keystore $KEYSTORE -alias $KEYSTORE_ALIAS -sigalg SHA1withDSA -keyalg DSA -keysize 1024



What I've tried



  • Java 1.7/1.8

  • Compiling against different Android platforms (21/28)

  • Including additional assets (didn't have icons originally)

  • Setting use-sdk in the manifest (no impact)

What am I missing?










share|improve this question






























    0















    I'm quite new to Android native development and lately experimenting with building directly from CLI without Android Studio (really don't like the IDE and find Gradle overly complex, although I can't get my toolchain running yet...)



    Using guidance from around the web, particularly this, I have a extremely basic app which successfully builds to a signed and aligned APK (as far as I can tell). I am building against platform 14 with Java 1.8 and I observed no changes when altering this configuration.



    I've put the app source on GitHub for reference for this question. It's one activity with one layout.



    When it comes to adb install (or manually install from the device), installation always fails with INSTALL_FAILED_INVALID_APK... Package /data/app/net.ilmiont.helloworld-...==/base.apk code is missing (... is some long ID by appearances).



    Logcat



    Running adb logcat during the installation attempt, I get this:



    11-16 10:34:52.729 24742 7402 I Finsky : [9791] com.google.android.finsky.verifier.impl.ea.a(82): Skipping verification. Disabled by user setting
    11-16 10:34:52.729 24742 7402 I Finsky : [9791] com.google.android.finsky.verifier.impl.ea.a(43): Skipping anti malware verification due to pre-check failure
    11-16 10:34:52.730 24742 24742 I Finsky : [2] com.google.android.finsky.verifier.impl.fs.c(164): Verifying id=132, result=1
    11-16 10:34:52.735 24742 24742 I Finsky : [2] com.google.android.finsky.verifier.impl.fs.c(177): Verification complete: id=132, package_name=net.ilmiont.helloworld
    11-16 10:34:52.752 1856 27782 E : Couldn't opendir /data/data/net.ilmiont.helloworld: No such file or directory
    11-16 10:34:52.753 1856 27782 E installd: Failed to delete /data/data/net.ilmiont.helloworld: No such file or directory
    11-16 10:34:52.753 1856 27782 E : Couldn't opendir /data/user_de/0/net.ilmiont.helloworld: No such file or directory
    11-16 10:34:52.753 1856 27782 E installd: Failed to delete /data/user_de/0/net.ilmiont.helloworld: No such file or directory
    11-16 10:34:52.754 2198 2398 W PackageManager: com.android.server.pm.Installer$InstallerException: android.os.ServiceSpecificException: Failed to delete /data/user_de/0/net.ilmiont.helloworld (code 2)
    11-16 10:34:52.756 2198 2398 W PackageManager: Package couldn't be installed in /data/app/net.ilmiont.helloworld-pbDVHiVe6mEghhiOqRUNjg==
    11-16 10:34:52.756 2198 2398 W PackageManager: com.android.server.pm.PackageManagerException: Package /data/app/net.ilmiont.helloworld-pbDVHiVe6mEghhiOqRUNjg==/base.apk code is missing



    I do not understand why it is trying to open/delete these directories when the app is just getting installed (and has not ever successfully installed) --- I don't know enough about Android internals, but from that trace it does look like the deletion is the problem.



    I've looked over my source multiple times and just can't see what I'm missing. The manifest looks OK, the layout looks OK, the Java is all of two lines. So what am I missing? It must be something glaringly obvious.



    The device



    This may be relevant, so here are all the details.



    Nokia 6 (original one) running unrooted Android 8.1.



    I opened Android Studio, created the default boilerplate app and hit "Run", and it built and deployed successfully, so clearly there is something wrong with my app/build toolchain which is making this break, and I've out of ideas of where to look.



    The build script (excerpts, it does build but will not deploy)



    aapt package -v -f -m -J $PROJECT_SOURCE -M $ANDROID_MANIFEST -S $ANDROID_RESOURCES -I $ANDROID_SDK/platforms/android-$ANDROID_API/android.jar;



    javac -d $JAVA_COMPILE_DESTINATION -source $JAVA_VERSION -target $JAVA_VERSION_TARGET -classpath "$PROJECT_SOURCE$JAVA_CLASSPATH_LIBS" -bootclasspath $ANDROID_SDK/platforms/android-$ANDROID_API/android.jar $PROJECT_SOURCE/$PROJECT_PACKAGE_SOURCE/*.java;



    dx --dex --output=$DX_COMPILE_DESTINATION $JAVA_COMPILE_DESTINATION;



    aapt package -f -m -F $APP_APK_UNALIGNED -M $ANDROID_MANIFEST -S $ANDROID_RESOURCES -I $ANDROID_SDK/platforms/android-$ANDROID_API/android.jar;



    aapt add $APP_APK_UNALIGNED $DX_COMPILE_DESTINATION;



    zipalign -f 4 $APP_APK_UNALIGNED $APP_APK;



    apksigner sign --ks /home/jh_walker/.keystore $APP_APK;



    Keystore



    keytool -genkeypair -validity 365 -keystore $KEYSTORE -alias $KEYSTORE_ALIAS -sigalg SHA1withDSA -keyalg DSA -keysize 1024



    What I've tried



    • Java 1.7/1.8

    • Compiling against different Android platforms (21/28)

    • Including additional assets (didn't have icons originally)

    • Setting use-sdk in the manifest (no impact)

    What am I missing?










    share|improve this question


























      0












      0








      0








      I'm quite new to Android native development and lately experimenting with building directly from CLI without Android Studio (really don't like the IDE and find Gradle overly complex, although I can't get my toolchain running yet...)



      Using guidance from around the web, particularly this, I have a extremely basic app which successfully builds to a signed and aligned APK (as far as I can tell). I am building against platform 14 with Java 1.8 and I observed no changes when altering this configuration.



      I've put the app source on GitHub for reference for this question. It's one activity with one layout.



      When it comes to adb install (or manually install from the device), installation always fails with INSTALL_FAILED_INVALID_APK... Package /data/app/net.ilmiont.helloworld-...==/base.apk code is missing (... is some long ID by appearances).



      Logcat



      Running adb logcat during the installation attempt, I get this:



      11-16 10:34:52.729 24742 7402 I Finsky : [9791] com.google.android.finsky.verifier.impl.ea.a(82): Skipping verification. Disabled by user setting
      11-16 10:34:52.729 24742 7402 I Finsky : [9791] com.google.android.finsky.verifier.impl.ea.a(43): Skipping anti malware verification due to pre-check failure
      11-16 10:34:52.730 24742 24742 I Finsky : [2] com.google.android.finsky.verifier.impl.fs.c(164): Verifying id=132, result=1
      11-16 10:34:52.735 24742 24742 I Finsky : [2] com.google.android.finsky.verifier.impl.fs.c(177): Verification complete: id=132, package_name=net.ilmiont.helloworld
      11-16 10:34:52.752 1856 27782 E : Couldn't opendir /data/data/net.ilmiont.helloworld: No such file or directory
      11-16 10:34:52.753 1856 27782 E installd: Failed to delete /data/data/net.ilmiont.helloworld: No such file or directory
      11-16 10:34:52.753 1856 27782 E : Couldn't opendir /data/user_de/0/net.ilmiont.helloworld: No such file or directory
      11-16 10:34:52.753 1856 27782 E installd: Failed to delete /data/user_de/0/net.ilmiont.helloworld: No such file or directory
      11-16 10:34:52.754 2198 2398 W PackageManager: com.android.server.pm.Installer$InstallerException: android.os.ServiceSpecificException: Failed to delete /data/user_de/0/net.ilmiont.helloworld (code 2)
      11-16 10:34:52.756 2198 2398 W PackageManager: Package couldn't be installed in /data/app/net.ilmiont.helloworld-pbDVHiVe6mEghhiOqRUNjg==
      11-16 10:34:52.756 2198 2398 W PackageManager: com.android.server.pm.PackageManagerException: Package /data/app/net.ilmiont.helloworld-pbDVHiVe6mEghhiOqRUNjg==/base.apk code is missing



      I do not understand why it is trying to open/delete these directories when the app is just getting installed (and has not ever successfully installed) --- I don't know enough about Android internals, but from that trace it does look like the deletion is the problem.



      I've looked over my source multiple times and just can't see what I'm missing. The manifest looks OK, the layout looks OK, the Java is all of two lines. So what am I missing? It must be something glaringly obvious.



      The device



      This may be relevant, so here are all the details.



      Nokia 6 (original one) running unrooted Android 8.1.



      I opened Android Studio, created the default boilerplate app and hit "Run", and it built and deployed successfully, so clearly there is something wrong with my app/build toolchain which is making this break, and I've out of ideas of where to look.



      The build script (excerpts, it does build but will not deploy)



      aapt package -v -f -m -J $PROJECT_SOURCE -M $ANDROID_MANIFEST -S $ANDROID_RESOURCES -I $ANDROID_SDK/platforms/android-$ANDROID_API/android.jar;



      javac -d $JAVA_COMPILE_DESTINATION -source $JAVA_VERSION -target $JAVA_VERSION_TARGET -classpath "$PROJECT_SOURCE$JAVA_CLASSPATH_LIBS" -bootclasspath $ANDROID_SDK/platforms/android-$ANDROID_API/android.jar $PROJECT_SOURCE/$PROJECT_PACKAGE_SOURCE/*.java;



      dx --dex --output=$DX_COMPILE_DESTINATION $JAVA_COMPILE_DESTINATION;



      aapt package -f -m -F $APP_APK_UNALIGNED -M $ANDROID_MANIFEST -S $ANDROID_RESOURCES -I $ANDROID_SDK/platforms/android-$ANDROID_API/android.jar;



      aapt add $APP_APK_UNALIGNED $DX_COMPILE_DESTINATION;



      zipalign -f 4 $APP_APK_UNALIGNED $APP_APK;



      apksigner sign --ks /home/jh_walker/.keystore $APP_APK;



      Keystore



      keytool -genkeypair -validity 365 -keystore $KEYSTORE -alias $KEYSTORE_ALIAS -sigalg SHA1withDSA -keyalg DSA -keysize 1024



      What I've tried



      • Java 1.7/1.8

      • Compiling against different Android platforms (21/28)

      • Including additional assets (didn't have icons originally)

      • Setting use-sdk in the manifest (no impact)

      What am I missing?










      share|improve this question
















      I'm quite new to Android native development and lately experimenting with building directly from CLI without Android Studio (really don't like the IDE and find Gradle overly complex, although I can't get my toolchain running yet...)



      Using guidance from around the web, particularly this, I have a extremely basic app which successfully builds to a signed and aligned APK (as far as I can tell). I am building against platform 14 with Java 1.8 and I observed no changes when altering this configuration.



      I've put the app source on GitHub for reference for this question. It's one activity with one layout.



      When it comes to adb install (or manually install from the device), installation always fails with INSTALL_FAILED_INVALID_APK... Package /data/app/net.ilmiont.helloworld-...==/base.apk code is missing (... is some long ID by appearances).



      Logcat



      Running adb logcat during the installation attempt, I get this:



      11-16 10:34:52.729 24742 7402 I Finsky : [9791] com.google.android.finsky.verifier.impl.ea.a(82): Skipping verification. Disabled by user setting
      11-16 10:34:52.729 24742 7402 I Finsky : [9791] com.google.android.finsky.verifier.impl.ea.a(43): Skipping anti malware verification due to pre-check failure
      11-16 10:34:52.730 24742 24742 I Finsky : [2] com.google.android.finsky.verifier.impl.fs.c(164): Verifying id=132, result=1
      11-16 10:34:52.735 24742 24742 I Finsky : [2] com.google.android.finsky.verifier.impl.fs.c(177): Verification complete: id=132, package_name=net.ilmiont.helloworld
      11-16 10:34:52.752 1856 27782 E : Couldn't opendir /data/data/net.ilmiont.helloworld: No such file or directory
      11-16 10:34:52.753 1856 27782 E installd: Failed to delete /data/data/net.ilmiont.helloworld: No such file or directory
      11-16 10:34:52.753 1856 27782 E : Couldn't opendir /data/user_de/0/net.ilmiont.helloworld: No such file or directory
      11-16 10:34:52.753 1856 27782 E installd: Failed to delete /data/user_de/0/net.ilmiont.helloworld: No such file or directory
      11-16 10:34:52.754 2198 2398 W PackageManager: com.android.server.pm.Installer$InstallerException: android.os.ServiceSpecificException: Failed to delete /data/user_de/0/net.ilmiont.helloworld (code 2)
      11-16 10:34:52.756 2198 2398 W PackageManager: Package couldn't be installed in /data/app/net.ilmiont.helloworld-pbDVHiVe6mEghhiOqRUNjg==
      11-16 10:34:52.756 2198 2398 W PackageManager: com.android.server.pm.PackageManagerException: Package /data/app/net.ilmiont.helloworld-pbDVHiVe6mEghhiOqRUNjg==/base.apk code is missing



      I do not understand why it is trying to open/delete these directories when the app is just getting installed (and has not ever successfully installed) --- I don't know enough about Android internals, but from that trace it does look like the deletion is the problem.



      I've looked over my source multiple times and just can't see what I'm missing. The manifest looks OK, the layout looks OK, the Java is all of two lines. So what am I missing? It must be something glaringly obvious.



      The device



      This may be relevant, so here are all the details.



      Nokia 6 (original one) running unrooted Android 8.1.



      I opened Android Studio, created the default boilerplate app and hit "Run", and it built and deployed successfully, so clearly there is something wrong with my app/build toolchain which is making this break, and I've out of ideas of where to look.



      The build script (excerpts, it does build but will not deploy)



      aapt package -v -f -m -J $PROJECT_SOURCE -M $ANDROID_MANIFEST -S $ANDROID_RESOURCES -I $ANDROID_SDK/platforms/android-$ANDROID_API/android.jar;



      javac -d $JAVA_COMPILE_DESTINATION -source $JAVA_VERSION -target $JAVA_VERSION_TARGET -classpath "$PROJECT_SOURCE$JAVA_CLASSPATH_LIBS" -bootclasspath $ANDROID_SDK/platforms/android-$ANDROID_API/android.jar $PROJECT_SOURCE/$PROJECT_PACKAGE_SOURCE/*.java;



      dx --dex --output=$DX_COMPILE_DESTINATION $JAVA_COMPILE_DESTINATION;



      aapt package -f -m -F $APP_APK_UNALIGNED -M $ANDROID_MANIFEST -S $ANDROID_RESOURCES -I $ANDROID_SDK/platforms/android-$ANDROID_API/android.jar;



      aapt add $APP_APK_UNALIGNED $DX_COMPILE_DESTINATION;



      zipalign -f 4 $APP_APK_UNALIGNED $APP_APK;



      apksigner sign --ks /home/jh_walker/.keystore $APP_APK;



      Keystore



      keytool -genkeypair -validity 365 -keystore $KEYSTORE -alias $KEYSTORE_ALIAS -sigalg SHA1withDSA -keyalg DSA -keysize 1024



      What I've tried



      • Java 1.7/1.8

      • Compiling against different Android platforms (21/28)

      • Including additional assets (didn't have icons originally)

      • Setting use-sdk in the manifest (no impact)

      What am I missing?







      android adb aapt






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 16 '18 at 12:44









      Fantômas

      32.8k156491




      32.8k156491










      asked Nov 16 '18 at 10:59









      IlmiontIlmiont

      65231230




      65231230






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I got there.



          aapt inspect app.apk



          And immediately I noticed in the APK, was ./bin/classes.dex, and none of the other files had that ./ prefix.



          Digging deeper, and I saw in my build script I was compiling DEX to ./bin/classes.dex, and then adding that path to my APK. But it appears something about that path wasn't liked by aapt (although it's entirely valid for where I was running it from), and it didn't properly add the file --- it seems just some empty ./bin/classes.dex it made up.



          (Yes that's a kinda pathetic explanation, and I'll investigate properly later!)



          Anyway, it seems you have to add from your current directory: classes.dex. Maybe this is obvious to someone more familiar with the tools.



          Anyway,



          cp ./bin/classes.dex . && aapt add app.apk.unaligned classes.dex works, but aapt add app.apk.unaligned ./bin/classes.dex does not .






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53336514%2fcannot-install-app-built-on-cli-outside-android-studio-failed-to-delete-err%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I got there.



            aapt inspect app.apk



            And immediately I noticed in the APK, was ./bin/classes.dex, and none of the other files had that ./ prefix.



            Digging deeper, and I saw in my build script I was compiling DEX to ./bin/classes.dex, and then adding that path to my APK. But it appears something about that path wasn't liked by aapt (although it's entirely valid for where I was running it from), and it didn't properly add the file --- it seems just some empty ./bin/classes.dex it made up.



            (Yes that's a kinda pathetic explanation, and I'll investigate properly later!)



            Anyway, it seems you have to add from your current directory: classes.dex. Maybe this is obvious to someone more familiar with the tools.



            Anyway,



            cp ./bin/classes.dex . && aapt add app.apk.unaligned classes.dex works, but aapt add app.apk.unaligned ./bin/classes.dex does not .






            share|improve this answer



























              0














              I got there.



              aapt inspect app.apk



              And immediately I noticed in the APK, was ./bin/classes.dex, and none of the other files had that ./ prefix.



              Digging deeper, and I saw in my build script I was compiling DEX to ./bin/classes.dex, and then adding that path to my APK. But it appears something about that path wasn't liked by aapt (although it's entirely valid for where I was running it from), and it didn't properly add the file --- it seems just some empty ./bin/classes.dex it made up.



              (Yes that's a kinda pathetic explanation, and I'll investigate properly later!)



              Anyway, it seems you have to add from your current directory: classes.dex. Maybe this is obvious to someone more familiar with the tools.



              Anyway,



              cp ./bin/classes.dex . && aapt add app.apk.unaligned classes.dex works, but aapt add app.apk.unaligned ./bin/classes.dex does not .






              share|improve this answer

























                0












                0








                0







                I got there.



                aapt inspect app.apk



                And immediately I noticed in the APK, was ./bin/classes.dex, and none of the other files had that ./ prefix.



                Digging deeper, and I saw in my build script I was compiling DEX to ./bin/classes.dex, and then adding that path to my APK. But it appears something about that path wasn't liked by aapt (although it's entirely valid for where I was running it from), and it didn't properly add the file --- it seems just some empty ./bin/classes.dex it made up.



                (Yes that's a kinda pathetic explanation, and I'll investigate properly later!)



                Anyway, it seems you have to add from your current directory: classes.dex. Maybe this is obvious to someone more familiar with the tools.



                Anyway,



                cp ./bin/classes.dex . && aapt add app.apk.unaligned classes.dex works, but aapt add app.apk.unaligned ./bin/classes.dex does not .






                share|improve this answer













                I got there.



                aapt inspect app.apk



                And immediately I noticed in the APK, was ./bin/classes.dex, and none of the other files had that ./ prefix.



                Digging deeper, and I saw in my build script I was compiling DEX to ./bin/classes.dex, and then adding that path to my APK. But it appears something about that path wasn't liked by aapt (although it's entirely valid for where I was running it from), and it didn't properly add the file --- it seems just some empty ./bin/classes.dex it made up.



                (Yes that's a kinda pathetic explanation, and I'll investigate properly later!)



                Anyway, it seems you have to add from your current directory: classes.dex. Maybe this is obvious to someone more familiar with the tools.



                Anyway,



                cp ./bin/classes.dex . && aapt add app.apk.unaligned classes.dex works, but aapt add app.apk.unaligned ./bin/classes.dex does not .







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 16 '18 at 16:14









                IlmiontIlmiont

                65231230




                65231230





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53336514%2fcannot-install-app-built-on-cli-outside-android-studio-failed-to-delete-err%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Top Tejano songwriter Luis Silva dead of heart attack at 64

                    ReactJS Fetched API data displays live - need Data displayed static

                    政党