程序类型已存在:com.android.vending.billing.IInAppBillingService

Program type already present: com.android.vending.billing.IInAppBillingService

问题只出现在发布版本或生成签名的 apk 上,当我构建调试时 - 没有这样的问题。

将 AS 升级到 3.1 版后立即出现问题

Program type already present: com.android.vending.billing.IInAppBillingService
Message{kind=ERROR, text=Program type already present: com.android.vending.billing.IInAppBillingService, sources=[Unknown source file], tool name=Optional.of(D8)}

依赖项:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
    implementation('org.apache.httpcomponents:httpmime:4.3') {
        exclude module: "httpclient"
    }
    implementation 'com.chauthai.swipereveallayout:swipe-reveal-layout:1.4.0'
    implementation 'com.github.clans:fab:1.6.4'
    implementation 'com.android.billingclient:billing:1.0'
    implementation 'com.nineoldandroids:library:2.4.0'
    implementation 'com.daimajia.slider:library:1.1.5@aar'
    implementation 'com.github.eggheadgames:Siren:1.5.0'
    implementation 'me.leolin:ShortcutBadger:1.1.18@aar'
    implementation 'me.everything:overscroll-decor-android:1.0.4'
    implementation 'com.baoyz.pullrefreshlayout:library:1.2.0'
    implementation 'com.nineoldandroids:library:2.4.0'
    implementation 'com.daimajia.slider:library:1.1.5@aar'
    //implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.github.esafirm.android-image-picker:imagepicker:1.8.0'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.google.android.gms:play-services-places:12.0.0'
    implementation 'com.google.android.gms:play-services-gcm:12.0.0'
    implementation 'com.github.mukeshsolanki:country-picker-android:1.1.9'
    implementation 'com.github.rey5137:material:1.2.4'
    implementation 'com.mikepenz:iconics-core:2.8.9@aar'
    implementation 'com.mikepenz:fontawesome-typeface:4.7.0.1@aar'
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    implementation 'com.android.support:design:27.0.2'
    implementation 'com.android.support:animated-vector-drawable:27.0.2'
    implementation 'com.android.support:customtabs:27.0.2'
    implementation 'com.android.support:support-annotations:27.0.2'
    implementation 'com.android.support:recyclerview-v7:27.0.2'
    implementation 'com.android.support:cardview-v7:27.0.2'
    implementation 'com.android.support:support-v4:27.0.2'
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'org.greenrobot:eventbus:3.0.0'
    implementation 'com.google.code.gson:gson:2.8.0'
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
        transitive = true
    }
    implementation 'com.google.firebase:firebase-firestore:12.0.0'
    implementation 'com.google.firebase:firebase-storage:12.0.0'
    implementation 'com.google.firebase:firebase-database:12.0.0'
    implementation 'com.google.firebase:firebase-messaging:12.0.0'
    implementation 'com.google.firebase:firebase-auth:12.0.0'
    implementation 'com.google.firebase:firebase-core:12.0.0'
    implementation 'com.facebook.android:facebook-android-sdk:4.30.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'me.relex:circleindicator:1.1.8@aar'
    implementation 'com.yalantis:ucrop:2.2.0'
    implementation 'com.appsflyer:af-android-sdk:4.8.8@aar'
    implementation 'com.android.installreferrer:installreferrer:1.0'
}

M 找不到解决此问题的解决方案,任何建议 - 欢迎。谢谢!

解决方案接近: 终于能够通过简单删除 aidl import lib 来解决问题,现在调试和发布都编译成功,不知道为什么这样,google 中 inAppPurchases 的文档似乎已经过时,似乎是这样 class自动从某处添加。

从 android 工作室中删除 IinAppBillingService.aidl 文件,然后再次 运行 应用程序。希望这会有所帮助。

在我的例子中,当我搜索时,同一个文件在不同位置使用.aidl 添加了两次,在 windows 项目的资源管理器源代码中,然后我能够找到它,然后我删除它,在它生成 APK 之后成功!

  • 每当您尝试添加 google 播放计费库时

implementation 'com.android.billingclient:billing:version-code'

  • 您必须从您的项目中删除 IInAppBillingService.aidl 文件。

在项目级别视图中检查 IInAppBillingService.aidl 的路径

  • path :- app > src > main > aidi and so on...

您只需删除这个aidi文件夹删除IInAppBillingService.aidl并重建您的项目。错误将消失。

在我解释我的修复之前,让我告诉你我是如何设法创建它的。

我从 Ionic In App Purchase 2 开始,在我用

部署之后,在开发中工作得很好

ionic cordova build android --prod --release

失败!无效

好的!我想我需要采用另一种方法/包,所以我转到 In App Purchase(如果我们想调用它,则为版本 1)

在开发模式下尝试 1 次失败后,我想,好吧,让我们回到版本 2,所以当我尝试部署时,0 次成功!

我尝试了以下对我有用的方法

  1. 删除node_modules文件夹
  2. 运行 npm install
  3. 运行 ionic cordova platform remove android && ionic cordova platform add android

所以我们很干净......现在是最重要的部分,你不能有多个版本的 in-app-purchase,所以我的解决方案是删除版本 1.

  1. 运行 cordova plugin remove cordova-plugin-inapppurchase

只是为了确定你是否干净,你应该找不到任何这 2