APK installable but not runnable

Hello,

I’ve updated cordova and ionic-cli to it’s latest release version and now if i build the project and install the APK the installation success (manually and using adb) but the app icon does not appear anywhere. The app is listed in settings > applications but nowhere else. I’m able to run my application in a device, and it works perfectly.

I’ve unzipped the APK and i’ve figured out that the AndroidManifest file is smaller:
-rw-r–r-- 1 diego users 4,1K 16.09.2016 18:49 AndroidManifest.xml
-rw-r–r-- 1 diego users 47K 21.07.2016 23:10 WorkingManifest.xml

I’ve cleaned and re-done the project so many times… I’ve downgraded ionic and cordova to it’s older version and still not working. Any idea?

Your system information:

Cordova CLI: 6.3.1
Gulp version: CLI version 1.2.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 1.2.0-nightly-1823
Ionic CLI Version: 2.0.0
Ionic App Lib Version: 2.0.0
OS: Distributor ID: ManjaroLinux Description: Manjaro Linux
Node Version: v6.4.0

Not sure that help, but have you uninstalled the previous app before installing the brand new one?

Sometimes I face a same problem, I could install but not run, on my Android, just after updating major plugins

Yes, i have. It does not work.

@dicearr How about Android Studio sdk? Have you updated it? Or are you using Ionic package? I would try to install it on another android device and see if the same thing happens.

Do you have the icon files in correct locations? Are they defined in the config file?

Can you see an app icon when you open it on the android emulator?

RGecy

Yes, i have updated the sdk. I have installed the app in two diferentes
devices, with the same results.

Yes, i’ve checked them and the config file too.

Yes, i can see the icon during the installation and in
settings>>applications.

@dicearr Maybe try ionic package and see what happens with that build!

Does it give you the option to Open the app right after you install?

RGecy

@rgecy I’m trying right now. And no, that option does not appear, It seems
to be disabled.

@dicearr You do have 3rd party apps enabled right?

Sorry to hear that.

Does it run in debug mode with the browser? And with the android simulator? If no, any stacktrace?

@rgecy Yes, of course.

@reedrichards It runs correctly in the device. But i cannot run it when installed from the APK.

Ok i’ve started a blank app with the tabs template and it works propertly, i mean it’s been installed and all seems to be right.

@dicearr Wow, all I can say is just test it each time you add a new plugin and see what happens!

Hope you get it figured out! Frustrating I know! I am fighting a battle myself right now with custom auth.

Good Luck,

RGecy

Ok the error seems to be in the config.xml file. Specifically in the “config-file” node that relies on cordova-custom-config plugin. The issue was detected and exposed in its github repository https://github.com/dpa99c/cordova-custom-config/issues/67. The plugin was accidentally overwriting this piece of code:

<intent-filter android:label="@string/launcher_name">
       <action android:name="android.intent.action.MAIN" />
       <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

instead of adding my custom intent-filter, so the app was not able to start.
@rgecy @reedrichards Thank you!!

PD: I’ve done a script to insert my intent-filter nodes automatically without using cordova-custom-config.

1 Like

I posted this solution in the GitHub issue but I’m copy/pasting it here in case somebody else haves this problem.

I was checking the code and the plugin actually supports to have more than one intent filter, with some conditions:

  • The parent must be exactly ./application/activity/[@android:name='MainActivity'].
  • Every intent-filter must have a unique android:label attribute.

Example:

<config-file target="AndroidManifest.xml" parent="./application/activity/[@android:name='MainActivity']">
    <intent-filter android:label="A UNIQUE LABEL HERE">
        <action android:name="android.intent.action.SEND" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="text/plain" />
    </intent-filter>
</config-file>

This will keep the LAUNCHER intent filter automatically set by Cordova (I was having the same problem as @dicearr).