标签: android-instant-apps

带有Native C++ Library的Android Instant App无法发布到运行Android N的设备/模拟器

有没有办法让Android Instant App与本机C++库一起使用?

我正在尝试将Android Instant App发布到设备/模拟器,但遇到了我的本机C++库的问题.它作为可安装的应用程序发布,但在发布为Instant App时无法找到该库.

为了消除任何其他问题,我使用新项目向导在Android Studio 3.0(Canary 1 171.4010489)中启动了一个新项目,并选择了以下设置:

第一页:

  • 包括已选中的C++支持

第二页:

  • 选择手机和平板电脑
  • 已选中包含Android Instant App支持

第六页:

  • C++标准设置为'C++ 11'
  • 检查了例外支持(-fexceptions)
  • 运行时类型信息支持(-frtti)已选中

生成的项目将作为可安装的应用程序发布(显示"来自C++的Hello"屏幕),但不是即时应用程序......它会出现以下错误:无法找到库,这与我遇到的错误相同我的实际应用项目:

couldn't find "libnative-lib.so"

完整错误:

05-24 17:48:30.316 7519-7519/? E/AndroidRuntime: FATAL EXCEPTION: main
     Process: com.mycompany.instantapp, PID: 7519
     java.lang.UnsatisfiedLinkError: byc[DexPathList[[zip file "/data/user/0/com.google.android.instantapps.supervisor/files/atom-cache/com.mycompany.instantapp/atom-download--feature-1495662507463/feature.jar"],nativeLibraryDirectories=[/data/user/0/com.google.android.instantapps.supervisor/files/native-lib/com.mycompany.instantapp, /system/lib, /vendor/lib]]] couldn't find "libnative-lib.so"
     ...
Run Code Online (Sandbox Code Playgroud)

我正在粘贴下面的相关gradle文件(全部由Android Studio生成):

应用程序/的build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "26.0.0 rc2"

    defaultConfig {
        applicationId "com.mycompany.instantapp"
        minSdkVersion 23
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    }
    buildTypes { …
Run Code Online (Sandbox Code Playgroud)

c++ android c++11 android-instant-apps android-studio-3.0

5
推荐指数
1
解决办法
961
查看次数

数字资产链接链接到我的网站

我已经创建了一个即时应用程序。我将其上传到我的Google控制台,但出现此错误。

www.kochchy.cz网站尚未通过数字资产链接协议链接到您的应用程序。将应用程序站点与Digital Assets Link链接。

[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
   "namespace": "android_app",
    "package_name": "com.kochchy.instantapptest.app",
    "sha256_cert_fingerprints":["A4:A6:74:15:F1:3E:38:3F:93:0F:EF:E3:A6:86:8E:7C:25:45:E8:80:5B:5E:35:70:49:20:DB:F8:CB:D4:FC:E0"]
  }
}] 
Run Code Online (Sandbox Code Playgroud)

即时和可安装的两个APK都使用相同的ID:com.kochchy.instantapptest.app(每个都在自己的模块清单中定义)

我的基本模块清单如下所示:

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

<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:theme="@style/AppTheme">

    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

        <meta-data
            android:name="default-url"
            android:value="https://www.kochchy.cz" />

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

            <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="www.kochchy.cz" />
            <data android:pathPattern="/menu" />
        </intent-filter>
    </activity>
</application>
</manifest> …
Run Code Online (Sandbox Code Playgroud)

android google-console-developer android-instant-apps

5
推荐指数
1
解决办法
5439
查看次数

即时应用相机意图

我开发了Instant App,我想用相机拍照.如果我启动已安装的应用程序,一切正常.但是使用Instant App,我收到以下错误:

java.lang.SecurityException: Not allowed to start activity Intent { act=android.media.action.IMAGE_CAPTURE launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 }
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

AndroidManifest.xml中

<uses-permission android:name="android.permission.CAMERA" />

活动:

private static int CAMERA_REQUEST = 1234;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_goodbye);

findViewById(R.id.mainButton).setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View view) {
          startCamera();
      }
  });
}

private void startCamera() {
    if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
        if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) {
        } else {
            ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, CAMERA_REQUEST);
        }
    } else {
        Intent …
Run Code Online (Sandbox Code Playgroud)

android android-camera android-permissions android-instant-apps

5
推荐指数
1
解决办法
888
查看次数

Instant App上的文本到语音崩溃

我正在实施一个使用Android设备上提供的文本到语音功能的即时应用程序.我已TextToSpeech按照Android开发博客文章中详述的说明设法初始化了一个实例,并为非即时应用程序正常工作.Android 中的文字转语音简介

我已经重构我的应用程序是一个即时应用程序,并已确认文本到语音功能在非即时应用程序中工作.但是ACTION_CHECK_TTS_DATA,在即时应用程序中运行以下意图时:

val checkIntent = Intent()
checkIntent.action = TextToSpeech.Engine.ACTION_CHECK_TTS_DATA
activity.startActivityForResult(checkIntent, initilizeTtsRequestCode)
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

FATAL EXCEPTION: main
 Process: [PACKAGE_NAME_REDACTED], PID: 9500
 java.lang.RuntimeException: Unable to start activity ComponentInfo{[PACKAGE_NAME_REDACTED]/[PACKAGE_NAME_REDACTED].ui.SNTMainActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.speech.tts.engine.CHECK_TTS_DATA }
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
     at android.app.ActivityThread.-wrap11(Unknown Source:0)
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
     at android.os.Handler.dispatchMessage(Handler.java:105)
     at android.os.Looper.loop(Looper.java:164)
     at android.app.ActivityThread.main(ActivityThread.java:6541)
     at java.lang.reflect.Method.invoke(Native Method)
     at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
  Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.speech.tts.engine.CHECK_TTS_DATA }
     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1936)
     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1615)
     at android.app.Activity.startActivityForResult(Activity.java:4472) …
Run Code Online (Sandbox Code Playgroud)

android android-instant-apps

5
推荐指数
1
解决办法
328
查看次数

已定义依赖功能,但未设置包ID.您可能缺少基本功能中的功能依赖项

我正在关注其中一个用于制作即时应用的Google Codelabs.

我正在尝试创建topeka-ui(即时应用程序的UI功能模块).

当我尝试运行其中一个即时应用程序模块时,它说:

已定义依赖功能,但未设置包ID.您可能缺少基本功能中的功能依赖项.

android android-instant-apps android-architecture

5
推荐指数
5
解决办法
2742
查看次数

您应该至少有一个活动的APK通过网络'intent-filter'映射到网站'sample.com'

尝试上传即时应用程序,但收到此错误

您应该至少有一个活动的APK通过网络'intent-filter'映射到网站'sample.com'.

<activity
    android:name=".ui.InstantSplash"
    android:screenOrientation="portrait"
    android:theme="@style/splashScreenTheme">

    <meta-data
        android:name="default-url"
        android:value="https://sample.com/base-app/salt_one" />

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

    <intent-filter
        android:autoVerify="true"
        tools:targetApi="m">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="http" />
        <data android:host="sample.com" />
        <data android:pathPrefix="/base-app" />
        <data android:scheme="https" />
    </intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)

android android-instant-apps

5
推荐指数
1
解决办法
879
查看次数

弹出谷歌播放(如Vimeo,Wisher,Buzzfeed) - 即时应用程序

如何在Wisher,Buzzfeed,Vimeo等弹出窗口中打开Goog​​le Play?

好心人 来自Buzzfeed

我查看了Google文档,但只有Google Play应用(market://)或浏览器(http://)开放.

我想在我的即时应用程序内打开,以便在屏幕上安装完整的应用程序.

android google-play android-instant-apps

5
推荐指数
2
解决办法
982
查看次数

运行单元测试用例时无法引用动态功能模块中的应用程序模块类

我们的项目具有动态功能模块,该功能模块依赖于应用程序模块。动态功能模块中的类依赖于应用程序模块。

我们在动态模块中也有单元测试用例,用于测试动态模块的各个类。当通过android studio运行时,单元测试运行良好。使用gradlew运行单元测试时出错。

下面是错误:

./gradlew:dynamic_feature1:testDebugUnitTest得到以下错误:

15:40:13.225 [DEBUG] [TestEventLogger]
15:40:13.225 [DEBUG] [TestEventLogger] com.example.dynamic_feature1.DynamicPresenterTest > testXyz FAILED
15:40:13.225 [DEBUG] [TestEventLogger]     java.lang.NoClassDefFoundError: com/example/dynamicfeature/AppBase
15:40:13.225 [DEBUG] [TestEventLogger]         at java.lang.ClassLoader.defineClass1(Native Method)
15:40:13.225 [DEBUG] [TestEventLogger]         at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
15:40:13.225 [DEBUG] [TestEventLogger]         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)```
Run Code Online (Sandbox Code Playgroud)

android android-gradle-plugin android-instant-apps dynamic-feature

5
推荐指数
1
解决办法
139
查看次数

具有动态功能的即时应用程序始终显示带有1个选项的消歧对话框

我正在尝试动态功能和Instant Apps。为了在各种功能之间导航,我使用了深层链接。

每次导航到另一个“活动”时,都会看到消歧对话框少于1秒,其中列出了1个应用程序。请注意,“ Once”和“ Always”(在荷兰语中)的选项是如何变灰的。

示例Github项目

我创建了一个简约的示例,该示例与我在Github上的当前结构相匹配。需要Android Studio 3.5-RC2

消歧对话框简短显示

一些上下文:

我非常有信心,深层链接配置正确。但是由于你们还是想检查一下,因此配置如下:

1-清单:

<activity
            android:name=".ProfileActivity">

        <intent-filter
                android:autoVerify="true"
                android:priority="100">

            <action android:name="android.intent.action.VIEW" />

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

            <data
                    android:host="giddy.entreco.nl"
                    android:pathPrefix="/profile"
                    android:scheme="http" />
            <data android:scheme="https" />

        </intent-filter>

    </activity>
Run Code Online (Sandbox Code Playgroud)

2-Assetlinks 我的域包含一个可公开访问的assetlinks.json

3-Sha's正确 我使用的sha's正确

Executing tasks: [signingReport] in project

SHA1: 3A:52:19:77:C1:AD:18:F4:98:21:77:74:37:DC:9B:89:02:64:6E:C6
SHA-256: 25:DD:C3:7B:8E:35:D3:39:D5:D4:6C:B5:EA:7D:14:AF:82:EC:9C:56:A6:F5:76:A3:E1:D7:69:B3:EC:58:72:E8
Valid until: Saturday, March 21, 2048
Run Code Online (Sandbox Code Playgroud)

4-确认的数字资产链接文件 所有检查均通过 https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://giddy.entreco.nl&relation=delegate_permission/common.handle_all_urls

5-测试URL意图 也可以!唯一的问题是我在短时间内看到了消歧对话框。

附加信息

  • apply plugin: 'com.android.dynamic-feature'在所有模块中使用(app当然课程除外)

  • Android Studio:3.5 RC2;Android-gradle-plugin:3.5.0-rc02

  • 我的设备是OnePlus6-配备氧气9.0.7和Android 9

  • 谷歌官方样片 …

android android-manifest android-instant-apps android-app-bundle android-app-links

5
推荐指数
1
解决办法
199
查看次数

Firebase动态链接未重定向到即时应用程序

我在Android 即时应用程序中使用Firebase 动态链接,但是不是在重定向至即时应用程序而是在浏览器中打开 URL 。

我尝试添加“ afl ”参数,但它也不起作用。

有人可以帮忙吗?

提前致谢。

java android firebase firebase-dynamic-links android-instant-apps

5
推荐指数
0
解决办法
52
查看次数