1

I have a multi-module project (supporting instant apps and installed app). When using AS 3.0 RC1 and RC2 I'm no longer able to launch app....getting

Default Activity not found

I have a number of product flavors and issue could be related to fact that appropriate LAUNCHER activity is declared in AndroidManifest.xml for each flavor (I have chosen one of those flavors in "Build Variants" section). This has been working fine up to AS 3.0 Beta 7.

John O'Reilly
  • 10,000
  • 4
  • 41
  • 63
  • if it seems to problems with version can you report here https://issuetracker.google.com/issues/new?component=192708&template=840533 – Prags Oct 21 '17 at 14:11
  • 2
    or Might be it hep you this https://stackoverflow.com/questions/46120608/android-instant-app-default-activity-not-found – Prags Oct 21 '17 at 14:20
  • I had a similar issue and was related to manifest merge errors. Do you see any warning in the app's manifest "Merged Manifest" tab? – Ariel Carbonaro Oct 24 '17 at 12:38
  • No, don't see any errors.....also this was working up to beta7....only started happening with RC1 and RC2. – John O'Reilly Oct 24 '17 at 12:58
  • Still an issue in AS 3.0 (stable)...released short time ago. – John O'Reilly Oct 25 '17 at 17:53
  • Yeah, have the same issue here, and thinking about reverting to AS 3.0 Beta 7 just to publish an important update to my app... – Zhyano Nov 06 '17 at 19:36
  • @Zhyano this only seems to be an issue when running from AS. – John O'Reilly Nov 06 '17 at 20:28
  • Yeah, but AS is behaving very oddly recently... – Zhyano Nov 06 '17 at 20:36
  • Perhaps taking a look at your merged AndroidManifest.xml for you instant app might help? It should be in the build outputs of the instant app module. In Android Studio you can navigate there in the Project view. You should see the instant app zip folder and if you open it from within Android Studio, it'll launch APK Analyzer which will show you the merged manifest – Lyla Nov 10 '17 at 22:06
  • Android Studio is now at 3.1 canary 5, so if this is still an issue, please provide a reproducible project to Google's IssueTracker https://issuetracker.google.com/issues/new?component=192708&template=840533 – TWL Dec 19 '17 at 00:37
  • @JohnO'Reilly did you find a solution to your problem? I am trying to follow this tutorial here: https://codelabs.developers.google.com/codelabs/android-instant-apps/index.html?index=..%2F..%2Fio2017#4 but using my own project instead. After creating the base feature with all the app's logic, and the APK module that includes it, I cannot build the project (like they said I would be able to). Default Activity not found is the error I get. – Felipe Ribeiro R. Magalhaes Feb 21 '18 at 11:33
  • @FelipeRibeiroR.Magalhaes afraid not....have to manually copy config in to default `AndroidManifest.xml` when running/debugging in AS (btw this isn't an issue though when just building from gradle) – John O'Reilly Feb 21 '18 at 11:35
  • @JohnO'Reilly my issue is probably because my App's build.gradle is very complex, with 3 build types and 2 flavors, and a lot of CI set-up logic. I don't know if those should remain in the base feature module or if I should put all that in the APK's module build.grade. It is hard to find documentation on this and all the tutorial only show how to do this with small projects. – Felipe Ribeiro R. Magalhaes Feb 21 '18 at 11:42
  • Still have this issue with AS 3.1 RC3 ....pretty sure it's related to base and apk modules having different package names (as is requirement for instant apps)....but only an issue again when run within AS – John O'Reilly Mar 20 '18 at 09:40
  • I'm not seeing this issue with https://github.com/googlesamples/android-instant-apps/tree/master/analytics .....trying to compare with my own project but haven't been able to see what difference could cause this yet – John O'Reilly Mar 27 '18 at 12:33
  • @FelipeRibeiroR.Magalhaes I found a solution (or at least workaround) for specific issue I had (answered below) in case that's useful for you as well – John O'Reilly Mar 28 '18 at 08:52

1 Answers1

5

Not sure how I didn't spot this but when viewing AndroidManifest.xml for apk module you can click on "Merged Manifest" tab which shows something like following:

Merging Errors: Error: Attribute provider#com.google.firebase.provider.FirebaseInitProvider@authorities value=(somepackage.base.firebaseinitprovider) from AndroidManifest.xml:69:29-108 is also present at AndroidManifest.xml:10:13-72 value=(somepackage.firebaseinitprovider). Suggestion: add 'tools:replace="android:authorities"' to element at AndroidManifest.xml:69:19-224 to override

I "fixed" this by adding following to base module AndroidManifest.xml

    <provider
        android:name="com.google.firebase.provider.FirebaseInitProvider"
        android:authorities="<mypackage>.firebaseinitprovider"
        android:exported="false"
        tools:node="merge"/>

I'm still not clear though on why this only happens when running from Android Studio.

John O'Reilly
  • 10,000
  • 4
  • 41
  • 63
  • Thanks for following up on this, but me and my team actually gave up on the project at the moment. Too many bugs and difficulties to get it working. We might give a shot at instant apps later down the road when things are more stable and hopefully easier. – Felipe Ribeiro R. Magalhaes Mar 28 '18 at 10:28
  • 1
    I think things have improved a lot since I started down path of adding Instant apps support. I did this recently for another app and it was pretty smooth. – John O'Reilly Mar 28 '18 at 10:34