标签: android-instant-apps

AAPT2编译失败:Android 3.0 Canary 1上的无效维度

我正在使用Instant Apps for Android.I安装了所有正确的软件包并厌倦了创建具有Instant App支持的新应用程序(在创建新应用程序时选中Instant App框).问题是我总是遇到编译工具的问题.是否有其他人有这个问题,并能够找到任何解决方法.

我的环境:

  • Android Studio 3.0 Canary 1
  • 编译SDK:25
  • 构建工具:"26.0.0 rc2"
  • Gradle插件:3.0.0-alpha1
  • Gradle:尝试了gradle-4.0-milestone1和2
  • Java 1.8/1.7
  • 操作系统:尝试了Windows 10和Linux Ubuntu 16.4 LTS

错误:

Error: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
aapt2 compile -o /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/res/merged/androidTest/debug /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml
Issues:
 - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:520 invalid dimen
 - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:521 invalid dimen
 - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:568 invalid dimen
 - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:594 invalid dimen
 - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:595 invalid dimen
 - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:597 invalid dimen
 - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:598 invalid dimen
 - ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:599 invalid dimen
 - ERROR: …
Run Code Online (Sandbox Code Playgroud)

android aapt android-studio android-gradle-plugin android-instant-apps

88
推荐指数
3
解决办法
3万
查看次数

找不到参数的方法 kapt()

我现在面临一个问题超过 3 天,我无法解决。自从我开始在 Android 上使用 Kotlin 以来,我停止使用“annotationProcessor”并开始使用“kapt”,在我开始构建 Android 即时应用程序之前,所有事情都在 kapt 上运行良好,当我将“kapt”添加到任何依赖项(如 Glide)时或 ButterKnife Gradle 总是显示找不到方法 kapt() 的错误

Could not find method kapt() for arguments [com.github.bumptech.glide:compiler:4.7.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Run Code Online (Sandbox Code Playgroud)

这是我的项目 Gradle 文件

项目gradle文件

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.2.71'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module …
Run Code Online (Sandbox Code Playgroud)

android gradle kotlin android-gradle-plugin android-instant-apps

70
推荐指数
6
解决办法
3万
查看次数

Android Instant App:如何创建URL可寻址模块?

Google最近更新了有关即时应用的文档:准备应用

大多数要点都很清楚,除非 3.如有必要,请重新构建您的应用.

他们建议零售模块,如浏览,搜索,项目详细信息和结账.

问题:如何将应用程序拆分为功能齐全且URL可寻址的模块?

我在这里看到几个问题:

  • 如果我们使用像dagger,butterknife这样的库,......所有模块都依赖于其他模块
  • 如果我们的模块根据需要包含(视图),如何在不导入此模块的情况下实现到另一个视图(来自另一个模块)的转换?

有人可以将光照进黑暗中吗?谢谢!

android android-build android-studio android-gradle-plugin android-instant-apps

25
推荐指数
1
解决办法
1509
查看次数

错误:找不到样式属性'@android:attr/windowExitAnimation'

我最近升级到了gradle-3.0.0-alpha8,之后在编译时没有解决一些样式.
发展环境:

  • IDE:Android studio 3.0 Bate3
  • Gradle构建工具:'com.android.tools.build:grad:3.0.0-beta3'
  • Gradle:gradle-4.1-all.zip

错误信息:

    Error:(94, 5) style attribute '@android:attr/windowExitAnimation' not found
    Error:(94, 5) style attribute '@android:attr/windowEnterAnimation' not found
Run Code Online (Sandbox Code Playgroud)

在gradle.properties文件中设置android.enableAapt2 = false可以解决这个问题.

但是,Instant App需要android.enableAapt2 = true.我该怎么办?

android gradle-3.0 android-instant-apps

21
推荐指数
2
解决办法
3万
查看次数

使用Dagger的Application Component构建Android Instant App

我目前正在尝试使用InstantApps,并希望将dagger包含在我的项目中.

我在设置应用程序AppComponent时遇到了问题.我的应用程序组件包括我的应用程序的所有功能匕首模块.

我基本上有:

  • 包含我的Application类的One Base应用程序模块
  • 每个Activity都有一个匕首模块的多个功能,所有功能都以Base作为依赖项.
  • 一个应用程序模块和即时模块都导入所有功能和基本应用程序模块.

我想在添加Instant App模块之前弄清楚设置.

来自InstantApps文档和项目示例.似乎Application类需要在Base中.从Dagger文档,到设置匕首:

 DaggerYourAppComponent.create().inject(this);
Run Code Online (Sandbox Code Playgroud)

应该包含在您的应用程序类中.但是,这似乎是不可能的,因为AppComponent需要引用所有功能匕首模块.

我的问题是:

  • 我应该在哪里添加我的AppComponent匕首模块?
  • 我应该将我的应用程序保存在app模块中而不是Base中吗?
  • 使用Instant Apps围绕Dagger的任何GitHub回购或文档?

谢谢

android dagger-2 android-instant-apps

20
推荐指数
1
解决办法
1549
查看次数

18
推荐指数
1
解决办法
2399
查看次数

即时应用程序 - 数字资产链接协议

每当我尝试将我的即时应用apks上传到Play商店时,都会出现以下错误:

  • 您的网站"www.mywebsitename.com"尚未通过Digital Assets Link协议链接到您的应用.请通过Digital Assets Link协议将您的网站链接到您的应用.

但是,每当我执行https://developers.google.com/digital-asset-links/tools/generator时,它都会成功与我的应用和网站相关联.知道为什么我会收到这个错误吗?可能是什么原因导致的

提前感谢您的帮助.

android digital-assets-links android-instant-apps

17
推荐指数
3
解决办法
2546
查看次数

应用索引是即时应用在谷歌搜索中显示所必需的

我开发了一个即时应用程序并将其发布到游戏商店,还有一个与Instant App相关联的网站.从这里测试了测试工具的app链接 .

点击其他应用程序(gmail,环聊)中的链接后打开该应用程序,但是从谷歌搜索点击我的网站是打开网页而不是即时应用程序.为了将网页从Google搜索重定向到应用,我还有什么需要做的吗?

我在Play商店发布了我的即时应用程序.当我点击gmail的链接时,它会在某些设备中以即时应用程序的形式打开(三星s6 note,moto g4 plus)

在某些设备上,它不能作为即时应用程序打开,但buzzfeed.com/tasty作为即时应用程序打开.(一加3加一加5).

我的数字资产链接是https://abdcoop.mybuzztm.com/.well-known/assetlinks.json

谁能够建议我缺少什么?

android deep-linking android-app-indexing applinks android-instant-apps

15
推荐指数
1
解决办法
526
查看次数

NFC即时应用

我正在尝试通过NFC打开即时应用程序.

我的AndroidManifest.xml中有类似下面的内容

            <intent-filter android:autoVerify="true">
            <action android:name="android.intent.action.VIEW" />
            <action android:name="android.nfc.action.NDEF_DISCOVERED" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data android:scheme="https" />
            <data android:scheme="http" />
            <data android:host="example-refresh.herokuapp.com" />
        </intent-filter>
Run Code Online (Sandbox Code Playgroud)

从链接转到https://example-refresh.herokuapp.com(显然是示例链接)时,单击即时应用正确加载.当从nfc标签打开该链接时,浏览器就会加载.我已经尝试过让nfc打开一个AAR(https://developer.android.com/guide/topics/connectivity/nfc/nfc.html#aar)这会导致当应用程序没有打开游戏商店链接时安装时,安装和应用程序正确打开nfc.如果我在nfc上有其他东西,所以它显示了消歧的选项,那么我可以为浏览器选项选择即时应用程序,但我希望它默认为即时应用程序.

是否有一些我缺少一个nfc标签来加载即时应用程序?我也试过使用分支,但没有运气.

android nfc deep-linking branch.io android-instant-apps

15
推荐指数
1
解决办法
818
查看次数

是否可以在模拟设备上发现并运行第三方Android Instant Apps?

我目前正在尝试了解Android即时应用程序.由于我没有任何支持它们的真实设备,我使用的是模拟器(来自Android Studio 3.0 Canary 9).我可以成功运行的"玩具"即时应用程序(像这样在我的模拟的Nexus 5X)(与Play商店),所以我相信我的开发环境配置是否正确.

但是,我很想知道第三方应用程序的发现过程,并了解用户体验是什么样的.由于缺乏合适的设备,我使用模拟的Chrome浏览器搜索启用了即时应用的网站(如Stack Exchange).但这些搜索只给我通常的网站(不是即时应用程序).

我非常感兴趣地阅读这篇文章,因为它似乎表明这应该有效.但是,这些答案似乎对我没有帮助.

  • 我在澳大利亚,应该是支持Instant Apps的国家之一.
  • 正如在一个答案中所建议的那样,我尝试发送应该在电子邮件中的即时应用程序中打开然后单击它们的链接,但它仍然只是将我发送到浏览器链接.
  • 关于DAL验证的答案很有意思,但在浏览器中打开链接时似乎不适用?

API 24和API 26模拟设备(两者都包括Play商店)目前处于不同的状态,可能是因为我一直在尝试各种技巧来使其工作.(TLDR:没有什么对我有用.)

  • 在API 24模拟设备上,如果我键入,adb shell pm list packages grep "com.google.android.instantapps.supervisor"那么它输出package:com.google.android.instantapps.supervisor为一个答案建议(但它仍然不起作用).

  • Google Play services for Instant Apps (version 1.9-sdk-155682639)安装API 24设备.

  • API 24设备在屏幕顶部显示"闪电"通知,说"开发模式有效": URLs will be routed to Dev Manager in order to launch Instant Apps locally. Uninstall Dev Manager to disable Development Mode.

  • 在API 24设备上,设置 - > Google - >即时应用,即时应用设置为true

  • 在API 26模拟设备上,如果我输入adb …

android android-emulator android-instant-apps android-studio-3.0

14
推荐指数
1
解决办法
838
查看次数