我需要为 Instant App 准备一个 Alpha 测试,它在 Android Studio 上运行起来就像一个魅力,但是当我尝试将它上传到 PlayStore 时它失败了,说:
上传失败
您的免安装应用 APK 应至少包含一个基础 APK。
应用程序结构使用三个模块完成:
- base : 它包含所有代码
- apk : Wrapper 获取可安装的 apk
- instantApp : 获取 InstantApp apk 的包装器
这是 build.gradles:
基础/build.gradle
buildscript {
repositories {
jcenter()
}
}
apply plugin: 'com.android.feature'
repositories {
jcenter()
mavenCentral()
flatDir {
dirs 'libs'
}
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 25
buildToolsVersion "26.0.0-rc2"
baseFeature = true
dataBinding {
enabled = true
}
defaultConfig {
minSdkVersion 18
targetSdkVersion 25
versionCode 7
versionName "1.1"
}
signingConfigs {
release {
[...]
}
}
buildTypes {
debug {
[...]
}
release {
minifyEnabled false
signingConfig signingConfigs.release
[...]
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
abortOnError false
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
application project(":apk")
[...]
}
apply plugin: 'com.google.gms.google-services'
APK/build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.0-rc2"
dataBinding {
enabled true
}
defaultConfig {
applicationId “…”
minSdkVersion 18
targetSdkVersion 25
versionCode 7
versionName "1.1"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
signingConfigs {
release {
[...]
}
}
buildTypes {
debug {
[…]
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
[…]
}
}
}
dependencies {
implementation project(':base')
}
InstantApp/build.gradle
apply plugin: 'com.android.instantapp'
dependencies {
implementation project(':base')
}
这是清单文件
基础/Manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package=“…”>
<uses-permission android:name="android.permission.INTERNET" />
[…]
<application
android:name=“[…].TrgApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppBaseTheme">
<activity
android:name=“[…].LauncherActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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"
android:host=“[domain]” />
</intent-filter>
</activity>
<activity
android:name="[…].RootActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<activity
android:name="[…].OnBoardingActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize" />
<activity
android:name="[…].LocationPickerActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<service android:name="com.parse.PushService" />
<receiver
android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<!--
IMPORTANT: Change "com.parse.starter" to match your app's package name.
-->
<category android:name="[…]" />
</intent-filter>
</receiver>
<meta-data
android:name="com.parse.push.gcm_sender_id"
android:value="id:[…]" />
</application>
</manifest>
APK/Manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="..." />
此软件包与应用程序的软件包不同
我已经尝试过这个解决方案:(Android Instant-release build 不包括基本 APK)但它不起作用。
我从上周五就被困住了,所以任何想法都可能很棒
提前致谢
PD:这是我的第一个问题,所以如果我没有正确地做到这一点,我很抱歉;)