预先感谢
只需尝试制作具有即时应用功能的虚拟应用即可。可安装部分运行良好,并且即时应用模块也已从android studio中启动,但是当上载到Play商店尝试播放时,没有显示立即尝试选项,并且显示了在浏览器中打开即时应用的链接或从聊天应用中点击即时应用的链接时显示未找到。跟随google i / o视频将应用程序转换为即时和代码实验室说明,以及一些其他博客和视频,但无法确定问题出在哪里。
基本模块: gradle:
apply plugin: 'com.android.feature'
android {
compileSdkVersion 27
baseFeature true
defaultConfig {
minSdkVersion 24
targetSdkVersion 27
versionCode 1
versionName "1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
application project(":appmodule")
}
清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.demo.anil.tictactoe">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!--<meta-data android:name="asset_statements" android:resource="@string/asset_statements" />-->
<!--<meta-data-->
<!--android:name="default-url"-->
<!--android:value="https://anilsharma92.000webhostapp.com/game" />-->
<activity android:name=".SplashActivity">
<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://anilsharma92.000webhostapp.com/game" />
</activity>
<activity android:name=".GameActivity">
<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="anilsharma92.000webhostapp.com" />
<data android:pathPattern="/game" />
</intent-filter>
</activity>
<activity android:name=".ExtraActivity">
<intent-filter>
<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="anilsharma92.000webhostapp.com" />
<data android:pathPattern="/extra" />
</intent-filter>
</activity>
</application>
</manifest>
app模块:
清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.demo.anil.appmodule">
<!-- <application -->
<!-- android:allowBackup="true" -->
<!-- android:icon="@mipmap/ic_launcher" -->
<!-- android:label="@string/app_name" -->
<!-- android:roundIcon="@mipmap/ic_launcher_round" -->
<!-- android:supportsRtl="true" -->
<!-- android:theme="@style/AppTheme" /> -->
<application
android:label="@string/app_name"
android:theme="@style/AppTheme"
>
<meta-data android:name="asset_statements" android:resource="@string/asset_statements" />
<!--<meta-data-->
<!--android:name="default-url"-->
<!--android:value="https://anilsharma92.000webhostapp.com/game" />-->
<activity android:name=".LoginActivity" />
<activity android:name=".FinishActivity"/>
</application>
</manifest>
gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.demo.anil.appmodule"
minSdkVersion 24
targetSdkVersion 27
versionCode 1
versionName "1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation project(':app-base')
}
即时应用gradle:
apply plugin: 'com.android.instantapp'
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 24
targetSdkVersion 27
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation project(":app-base")
}
获得