1

I have an application that I want to create an instantApp for it. I successfully apply changes to my project and it builds successfully.

But there is 2 problem: -I couldn't run the application and the error is:

Default Activity not found

enter image description here

And another problem is that when I run the instantApp I see an error message that says Google Play Store has stoped

enter image description here

I have an app and two Instant App Feature Module that are base and feature.

And these is my feature manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
          package="instantapp.samples.yaramobile.com.base.feature">

    <application tools:ignore="GoogleAppIndexingWarning">

        <activity android:name=".presenter.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>

            <intent-filter
                    android:autoVerify="true"
                    android:order="1">
                <action android:name="android.intent.action.VIEW"/>

                <category android:name="android.intent.category.BROWSABLE"/>
                <category android:name="android.intent.category.DEFAULT"/>

                <data android:host="test.com"/>
                <data android:pathPattern="/"/>
                <data android:scheme="https"/>
                <data android:scheme="http"/>
            </intent-filter>
        </activity>

        <activity android:name=".presenter.display.DisplayActivity"/>
        <activity android:name=".presenter.display.PermissionActivity"/>
    </application>
</manifest>
Ehsan
  • 2,676
  • 6
  • 29
  • 56
  • Regarding "Default Activity not Found", check out https://stackoverflow.com/questions/46862821, https://stackoverflow.com/questions/46120608 posts. – Julia K Jan 16 '19 at 18:29
  • For your `Google Play Store has stopped` issue, it's best if you split this off to a new question, and you should provide a stacktrace from your logcat. – TWL Jan 16 '19 at 19:07

2 Answers2

1

I finally found the problems and solutions:

The problem was about AppCompact dependency:

implementation 'androidx.appcompat:appcompat:1.0.2'

there was a conflict and I had to use of api instead of implementation

api 'androidx.appcompat:appcompat:1.0.2'

and there was another conflict with room dependencies:

 implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
 kapt 'androidx.lifecycle:lifecycle-compiler:2.0.0'
 implementation 'androidx.room:room-runtime:2.1.0-alpha02'
 kapt 'androidx.room:room-compiler:2.1.0-alpha02'

I had to replaced with api too:

 api 'androidx.lifecycle:lifecycle-extensions:2.0.0'
 kapt 'androidx.lifecycle:lifecycle-compiler:2.0.0'
 api 'androidx.room:room-runtime:2.1.0-alpha02'
 kapt 'androidx.room:room-compiler:2.1.0-alpha02'

Another problem was about databinding I Just added databinding in my base module but it's needed in installed module too:

  dataBinding{
        enabled = true
    }

and again is about room: I had to add a provider into the manifest of the base module because I had an error in merge manifest in my installed module because of these provider that is used in room dependencies:

<provider
        tools:replace="android:authorities"
        android:name="androidx.lifecycle.ProcessLifecycleOwnerInitializer"
        android:authorities="codenevisha.ir.mvvmwithdagger.base.lifecycle-process"
        android:exported="false"
        android:multiprocess="true"/>

don't forget to replace this provider with adding tools:replace="android:authorities"

Hope these guidelines will you too.

Ehsan
  • 2,676
  • 6
  • 29
  • 56
0

Based from this thread, if you see that error occur after upgrading versions of IntelliJ IDEA or Android Studio, or after Generating a new APK, you may need to refresh the IDE's cache.

File -> Invalidate Caches / Restart...

It also means that you don't have an activity declared in AndroidManifest.xml that is marked as the main activity to be launched when the application starts.

abielita
  • 13,147
  • 2
  • 17
  • 59