uwotm8 uwotm8 - 3 months ago 57
Android Question

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. "IInAppBillingService.aidl"

Then i also have the helper classes under "util" in the same directory
com.android.vending.billing.util.IabHelper;

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

Error:(12, 40) error: package com.android.vending.billing.util does not exist

Error:(13, 40) error: package com.android.vending.billing.util does not exist

Error:(14, 40) error: package com.android.vending.billing.util does not exist

Not sure what the issue is here. All help appreciated

Thank you

Answer

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.

Comments