1

I have an instant app, and its working nice, but if I add this line to my base/build.gradle then I cant run my app/installed, note that I can run it with a url.

api 'com.google.firebase:firebase-core:16.0.1'

The error is "Default activity not found". Removing the compile firebase, voilá the activity is found.

Using implementation instead of api the app runs nice, but firebase says "installation unsucessful" but using api and running it as a instant app firebase says "successful"

My build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion



    defaultConfig {
        applicationId "com.example.android.app"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode rootProject.ext.versionCodeInstalled
        versionName rootProject.ext.versionNameInstalled
    }

    buildTypes {
       release {
           minifyEnabled false
           proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
       }
    }

}

dependencies {
    implementation project(':feature')
    implementation project(':base')
}

Manifest app:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.app" />

Manifest base:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android">

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <meta-data
            android:name="aia-compat-api-min-version"
            android:value="1" />
    </application>

</manifest>

Any idea?

Pablo Cegarra
  • 20,955
  • 12
  • 92
  • 110
  • Seems like the problem is adding firebase to my /app/build.gradle I dont know why – Pablo Cegarra Jun 19 '18 at 21:29
  • This seems to be a known issue https://stackoverflow.com/questions/46666474/firebaseapp-initialization-unsuccessful-in-android-instant-apps – TWL Jun 19 '18 at 22:03
  • As a temporary workaround, you can find which manifest is affected and needs a modification. It should be the module where the plugin is applied, but check the merged manifest and look for an error that says: add 'tools:replace="android:authorities"' to ... – TWL Jun 19 '18 at 22:05
  • modify it according to that suggestion and your issue should be resolved – TWL Jun 19 '18 at 22:06
  • This can happen when gradle fails to sync. Are you able to build your project from the command line? – dazza5000 Jun 21 '18 at 02:20

1 Answers1

0

This solution worked for me:

In the base/manifest

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <meta-data
        android:name="aia-compat-api-min-version"
        android:value="1" />

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

</application>
Pablo Cegarra
  • 20,955
  • 12
  • 92
  • 110