how can I add the aidl file to Android studio (from the in-app billing example)
Just as the error message says, you need to put IInAppBillingService.aidl
in the correct directory dictated by it's package (com.android.vending.billing).
Within the src/main/aidl/
folder you already have, put the .aidl
file in com/android/vending/billing/
.
Android Studio: How to import AIDL file from a different Android Studio project?
Problem "worked around". Here is how:
- I undid the manual addition into the app's build.gradle:
sourceSets {
main.java.srcDirs += '../../NoActivity/app/src/main/aidl/com/example/tutorialspoint7/noactivity'
}
I manually created the folder
..\AIDLActivity\app\src\main\aidl\com\example\tutorialspoint7\noactivity
, and then copied over to there the originalIMyAidlInterface.aidl
file from the 'NoActivity' service project.Adding
import com.example.tutorialspoint7.noactivity;
in AIDLActivity.java doesn't work!!! so... I worked around this by simply referencingIMyAidlInterface
using its fully qualified name:
Gradle sync the projects
The AIDLActivity project now builds without any errors. :-)
Credits goes to this Jun 18, 2013 post by dominik2...@gmail.com: https://code.google.com/p/android/issues/detail?id=56755#c1
Update: I managed to avoid the explicit fully qualified name ugliness by simply importing the specific interface, not the package (duh!):
All is well now but... Why do I have to keep copying the interface file whenever it changes in the original service, instead of just referencing it? I wish there were a way to reference (instead of copy) an AIDL file in Android Studio (version 2.2.3).
create directory for aidl file
Use your default system file explorer. Navigate to the src/main folder of your project and create the following folders.
- create folder
aidl
- inside the
aidl
folder: create foldercom
- inside the
aidl/com
folder: create folderandroid
- inside the
aidl/com/android
folder: create foldervending
- inside the
aidl/com/android/vending
folder: create folderbilling
Then paste the IInAppBillingService.aidl
file inside your billing folder. Back to Android Studio and you will use the package with the file using the "Android" view.
Android studio can`t find aidl import
In my case, recreating the parcelable AIDL files solved the problem. Delete and recreate e.g. SipProfile.aidl (the content seems to be already correct) containing:
package com.csipsimple.api;
parcelable SipProfile;
I used right click on the aidl folder -> New -> AIDL -> New Aidl File
. The root cause could be an internal gradle problem...
Perhaps combining this with a Android Studio restart or Build -> Clean project
might also help.
android inapp billing error IInAppBillingService.aidl
You should not copy the IInAppBillingService.aidl in your own directory(aidl\IInAppBillingService.aidl). It should be there in this directory only.
com\android\vending\billing\IInAppBillingService.aidl
Related Topics
Flutter Does Not Find Android Sdk
Apk Location in New Android Studio
How to Get the Position Selected in a Recyclerview
Android Slidingdrawer from Top
Android:Fill Spinner from Java Code Programmatically
Close Application and Remove from Recent Apps/
Android: Overlay on Android Camera Preview
Setresult Does Not Work When Back Button Pressed
Getting the Dimensions of the Soft Keyboard
Add a Search Filter on Recyclerview with Cards
List All Camera Images in Android
The Process of the Service Is Killed After the Application Is Removed from the Application Tray
How to Update My Adt in Eclipse
Android.View.View.Systemuivisibility Deprecated. What Is the Replacement