带有即时应用程序的android体系结构组件 [英] android architecture components with instant app

本文介绍了带有即时应用程序的android体系结构组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为即时应用程序准备好我的应用程序. 我创建了一个应用程序模块,基本模块和功能模块. 如果我在这种配置下运行项目,一切都会很好.

I want to make my app ready for instant apps. I have created an app module, base module and a feature module. if I run my project in this configuration everything works great.

当我在基本模块Gradle文件中实现以下代码行时.

when i implement the following lines inside my base module Gradle file.

annotationProcessor "android.arch.lifecycle:compiler:1.0.0"
api "android.arch.lifecycle:extensions:1.0.0"

Gradle构建成功,但是我丢失了默认活动并且无法运行该项目.默认活动在我的基本模块清单中.

the Gradle build succeeds but I lose my default activity and can't run the project. the default activity is inside my base module manifest.

如果我通过实施更改扩展行.

if i change the extensions line with implementation.

implementation "android.arch.lifecycle:extensions:1.0.0"

发生以下错误:

错误:任务':app:preDebugBuild'的执行失败.

Error:Execution failed for task ':app:preDebugBuild'.

Android依赖项"android.arch.lifecycle:runtime"对于编译(1.0.0)和运行时(1.0.3)类路径具有不同的版本.您应该通过DependencyResolution手动设置相同的版本

Android dependency 'android.arch.lifecycle:runtime' has different version for the compile (1.0.0) and runtime (1.0.3) classpath. You should manually set the same version via DependencyResolution

有人知道这个问题可能是什么吗?

does anyone knows what the problem can be?

推荐答案

使用支持库26.1.0或更高版本时,其中包含生命周期功能.通过删除以下lib行

When using the support lib 26.1.0 or higher the lifecycle functionality is included inside. by removing the following lib lines

annotationProcessor "android.arch.lifecycle:compiler:1.0.0"
api "android.arch.lifecycle:extensions:1.0.0"

并且仅使用:

 implementation 'com.android.support:appcompat-v7:26.1.0'

一切恢复正常.

官方文档参考

这篇关于带有即时应用程序的android体系结构组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆