gpt4 book ai didi

android - 为现有应用程序创建即时应用程序

转载 作者:行者123 更新时间:2023-11-29 23:21:55 25 4
gpt4 key购买 nike

我有一个应用程序,我想为它创建一个 instantApp。我成功地将更改应用于我的项目并成功构建。

但是有两个问题:-我无法运行该应用程序,错误是:

Default Activity not found

enter image description here

另一个问题是,当我运行 instantApp 时,我看到一条错误消息,上面写着 Google Play Store has stopped

enter image description here

我有一个 app 和两个 Instant App Feature Module,分别是 basefeature

这是我的功能 list :

<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>

最佳答案

终于找到了问题和解决办法:

问题出在 AppCompact 依赖性上:

implementation 'androidx.appcompat:appcompat:1.0.2'

有冲突,我不得不使用 api 而不是 implementation

api 'androidx.appcompat:appcompat:1.0.2'

还有另一个与房间依赖性的冲突:

 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'

我也必须用 api 替换:

 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'

另一个问题是关于数据绑定(bind)我刚刚在我的基本模块中添加了 databinding 但它在已安装的模块中也需要:

  dataBinding{
enabled = true
}

再次是关于房间:我必须将提供程序添加到基本模块的 manifest 中,因为我的 installed 模块中的合并 list 出现错误,因为 中使用了这些提供程序房间 依赖项:

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

不要忘记通过添加 tools:replace="android:authorities"

替换此提供程序

希望这些指南对您也适用。

关于android - 为现有应用程序创建即时应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54215419/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com