简体   繁体   English

Android Studio错误:包com.android.vending.billing.util不存在

[英]Android Studio error: package com.android.vending.billing.util does not exist

currently going through implementation of in app billing and have done the following. 目前正在实施应用内结算并完成以下操作。

Updated manifest to include billing 更新了清单以包含结算

Placed aidl file aidl folder // com.android.vending.billing. 放置aidl文件aidl文件夹// com.android.vending.billing。 "IInAppBillingService.aidl" “IInAppBillingService.aidl”

Then i also have the helper classes under "util" in the same directory com.android.vending.billing.util.IabHelper; 然后我在同一目录com.android.vending.billing.util.IabHelper中的“util”下也有帮助器类;

When running them as imports in my main activity i am getting an error when compiling, but missing variables are recognized when these are imported. 在我的主要活动中将它们作为导入运行时,我在编译时遇到错误,但在导入这些变量时会识别缺失的变量。

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.content.Intent;

import com.android.vending.billing.IInAppBillingService;
import com.android.vending.billing.util.IabHelper;
import com.android.vending.billing.util.IabResult;
import com.android.vending.billing.util.Purchase;
import com.android.vending.billing.util.Inventory;

The errors are as follows. 错误如下。

Error:(11, 40) error: package com.android.vending.billing.util does not exist 错误:(11,40)错误:包com.android.vending.billing.util不存在

Error:(12, 40) error: package com.android.vending.billing.util does not exist 错误:(12,40)错误:包com.android.vending.billing.util不存在

Error:(13, 40) error: package com.android.vending.billing.util does not exist 错误:(13,40)错误:包com.android.vending.billing.util不存在

Error:(14, 40) error: package com.android.vending.billing.util does not exist 错误:(14,40)错误:包com.android.vending.billing.util不存在

Not sure what the issue is here. 不知道这里的问题是什么。 All help appreciated 所有帮助赞赏

Thank you 谢谢

Since you put those files in your own package you have to import them from there. 由于您将这些文件放在自己的包中,因此必须从那里导入它们。 So instead of 而不是

import com.android.vending.billing.util.IabHelper;

it should be 它应该是

import yourpackage.util.IabHelper;

and so on. 等等。 I hope I was able to help you! 我希望我能帮到你!

I guess I missed something from your question: 我想我错过了你的问题:

Leave the IInAppBillingService.aidl in the package where it is at but put all the other files (the whole util directory) in your main package and then import them from there. 将IInAppBillingService.aidl保留在它所在的包中,但将所有其他文件(整个util目录)放在主包中,然后从那里导入它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM