【问题标题】:The package name of your Instant App APKs should be the same as your app's package name您的免安装应用 APK 的包名称应与您的应用的包名称相同
【发布时间】:2017-12-03 22:19:22
【问题描述】:

我正在尝试将我的即时应用程序上传到 Play 商店。我看到以下上传即时应用程序 apk zip 的错误:
您的免安装应用 APK 的包名称应与您的应用的包名称相同

我的 build.gradles 对应的功能如下:
已安装的 apk (build.gradle):

apply plugin: 'com.android.application'

 android {
compileSdkVersion 26
buildToolsVersion "27.0.1"


defaultConfig {
    applicationId "arith.math.arithapk"
    minSdkVersion 23
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

 dependencies {
implementation project(':arithbase')
implementation project(":arithmaticsumfeature")
 }

基础(build.gradle):

  //apply plugin: 'com.android.application'
 apply plugin: 'com.android.feature'

 android {
compileSdkVersion 26
buildToolsVersion "27.0.1"
baseFeature = true
defaultConfig {
    minSdkVersion 23
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
    "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
      }

  dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-
 core:3.0.1', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
feature project(":arithmaticsumfeature")
api 'com.android.support:appcompat-v7:26.1.0'
   application project(':arithapk')
}

功能(build.gradle):

     apply plugin: 'com.android.feature'

      android {
compileSdkVersion 26
buildToolsVersion "27.0.1"


defaultConfig {
    minSdkVersion 23
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
  }

   dependencies {
api project(':arithbase')
    }

免安装应用(build.gradle):

          apply plugin: 'com.android.instantapp'

  dependencies {
implementation project(':arithbase')
implementation project(":arithmaticsumfeature")
   }

谁能帮我解决这个问题。 ?

提前致谢

【问题讨论】:

  • 如果您还没有访问过documentation,请尝试访问。有这部分(具有多种功能的免安装应用的结构)描述了免安装应用的结构是由什么组成的,以及减小应用大小以优化代码的方法。有关更多示例,您可以访问此SO post,它与您遇到的错误相同。
  • 更新基础(build.gradle)

标签: android android-instant-apps


【解决方案1】:

使用应用程序项目(':arithapk')更新了基础(build.gradle)并修复了问题

【讨论】:

    【解决方案2】:

    刚刚解决了这个问题,通过在每个模块的 Android Manifest 中设置正确的包名称,遵循以下规则:

    基本模块:基本模块包名称需要与您在应用程序模块的 build.gradle 文件中为 applicationID 设置的值相同,在本例中为“arith.math.arithapk”。

    应用模块:应用模块包名需要比build.gradle中设置的applicationID低一级。如果您的 Base 模块包名称为“arith.math.arithapk”,您可以将应用模块包名称设置为“arith.math.arithapk.app”或“arith.math.arithapk.application”。

    Instant App Module:您不需要为此模块设置任何包名称,因为它没有清单。

    功能模块:功能模块的包名应该比基本模块包名低一级,例如“arith.math.arithapk.feature”

    【讨论】:

      猜你喜欢
      • 2018-05-12
      • 1970-01-01
      • 2018-02-06
      • 1970-01-01
      • 1970-01-01
      • 2014-07-17
      • 1970-01-01
      • 2018-05-09
      • 2018-04-21
      相关资源
      最近更新 更多