IInAppBillingService.java does not generate Java file in Android Studio - java

I am following this tutorial:
https://developer.android.com/google/play/billing/billing_integrate.html#billing-permission
No InAppBillingActivity file is generating. I'm not sure why. I checked to make sure everything is placed correctly but no luck. Here is what my folder structure looks like:
Click this for picture
Now I know there are similar questions like this but none of them were able to solve my problem. I have already imported googles billing library as well. No file generates when I run / build the app.

The problem is that the docs are not very accurate in specifying where it is that you will find the java file that should be in the gen folder. I had faced the same problem and had broken my head over it, until I found that the .java file was infact generated and it was in the path :
\app\build\generated\source\aidl\debug\com\android\vending\billing\IInAppBillingService.java
Its not a headache issue and your code runs smoothly itself without any interventions required. Hope this helps!

In android studio double click on your package name:
click in New and then on AIDL
Hope it helps

Its usually generated but not put where the tutorial tells you. If you do a Ctrl+N and type in the class name in intelliJ you may be able to find it

Related

Eclipse Error: Overlaps the location of other project

I am trying to create a new java project in my workspace. But i am getting the following Error:
"Overlaps the location of other project"
My current projects in:
Documents/workspace/Folder/{projects(About 10 Projects)}
If i create a new project from Eclipse, the new projects are coming under:
Documents/workspace/{New Project}
I have tried to the following steps to resolve this mentioned in other posts in stackoverflow.com:
Eclipse: Error ".. overlaps the location of another project.." when trying to create new project
But i am not able to solve this. Can anyone help please?
Ok, I fought this issue for a day and feel quite humble when I finally read all the post and figured out a good solution. This should be added to an Eclipse ten commandments... Thou shalt separate your workspace from your code and never the two shall meet. In that create the folder structure something like this:
C:\workspace\training\
C:\training\maven102-section1-initial-master\...
When you open Eclipse, point your Work space to the "c:\workspace\training" area. And for all your code, keep it in the "c:\training\maven102..." area.
My issue was having EVERYTHING ALL in the same folder, like a big old hoarder... and that does not work out either. Enjoy!

Import EMX into Eclipse via command line

I hope my question will be clear enough as I am not used to Eclipse environment.
My goal is to create a project in Eclipse with an already existing EMX file. I gather that file from a Git repository.
And I would like to create a command line (or a script, or anything I can run automatically from remote) that imports that EMX file into Eclipse, so I can use another script (already created) to work with this EMX.
My problem is that I don't know how to create this script or command line.
I've tried solutions found here at StackOverflow, without success. Maybe I'm just bad :p
As I am beginner in Eclipse stuff, if someone has a link to a clear tutorial or working example, it would be very nice.
Note: I just have the EMX file (no .project or whatever). So I guess I need to create a project with this file, and not just import an existing project.
Thank you very much for your help :)
Laurent
I finally managed to do what I wanted by creating a plugin which imports projects from a given path into my current workspace.
Main part of the code is from: http://code.google.com/p/headlesseclipse/source/browse/branches/JUnit/com.ind.eclipse.headlesseclipse/src/com/ind/eclipse/headlessworkspace/HeadlessProjectImport.java?r=88
I did not find any way to do this outside the plugin. Grovvy solution was giving plenty of errors and without CDT, the first simple solution I looked for was not available.

java.lang.NoClassDefFoundError: com.google.ads.AdView

I am attempting to incorporate admob ads in my app. So far I have added the following code
in the onCreate method of my app's main activity...
adView = new AdView(this,AdSize.BANNER,"my code number");
adView.loadAd(new AdRequest());
The program compiles without error but at run time I get the message java.lang.NoClassDefFoundError: com.google.ads.AdView. I have seen a supposed explanation of the problem and the cure here but I could not see how it was applicable to my project because I do not have either a "lib" or "libs" directory within my project.
According to eclipse's SDK manager, I have the most up to date version of everything that I use.
I had a similar problem, but did not have to add the libs folder; I tried, with no success, then removed them afterwards, when I realized that I had just forgotten to export the included Jar archived.
Fix:
Select project settings > Java Build Path, then Order and export.
Here, check the GoogleAdMobAdsSdk-package.
This should solve the NoClassDefFoundError-issue.
Just create manually the "libs" folder, and add your libraries there. By default, they doesn't exist
Project-> Clean
Project settings -> Java Build Path. Open "Order and export" tab.
Check GoogleAdMobsAdsSDK.
It is worked for me.
Was getting this error updating from android 16 to 20.
Solved by going to Java Build Path, Order and Export tab, checked and moved GoogleAdMobAdsSdk just under my source. For some reason that fixed it.
Changing the order back didn't break it. So some setting must have needed to be initialized.
I had this problem, and this problem too:
Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode and Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode
Despite many hours of following all solutions listed the only way I could get my app to work was to use the AdMob banner example here:
https://github.com/googleads/googleads-mobile-ios-examples/tree/master/admob/SmartBannerExample
And re-build my project around it, copying my files in to that project. If you are stuck, try it.
Don't know why it worked, but now it does. Something in my project was very wrong. Now I can carry on with my work. I love Google/Android, but really what a mess!
See this answer Android update 17 seems incompatible with external Jars.
You need to put all jars in libs folder insted of lib.
It's not enough only to add "GoogleAdMobAdsSdk-6.4.1.jar" in Java Build Path,then you should switch to table:Order and export.check the "GoogleAdMobAdsSdk-6.4.1.jar" here.
UPDATE:
Select project settings > Java Build Path, then Order and export.
Here, check the google-play-services.jar.
This should solve the NoClassDefFoundError-issue.
In my case I needed to click on the "Android Private Libraries" on the "Order and Export" Tab
Go to Properties - Java Build Path - Order and Export and check every Checkmark! That did the trick for my project.

R.layout.main couldn't be resolved

I am building an application and I added a new activity to generate a view. I compiled it. My application can not find anything that is on the format R.id.xxx or R.layout.xxx, I've tried also cleaning my project, closing Eclipse and opening Eclipse again, but nothing. The most strange thing is that before everything was working well. But now it can not recognize even the R.layout.main that is default of my principal activity. Anyone have an idea?
Also I have tried almost everything here: R cannot be resolved - Android error
but no result!
Solved
Thanks to woopsy, also I found the reference to this kind of problem
http://source.android.com/source/using-eclipse.html
it happens because Eclipse sometimes imports R when you press the combination ctrl+shift+O
Remove all your imports for the Activity and then have eclipse fix imports. I have had problems where eclipse wants to import a different R than the one I need.
First of All Check You have R.java File then check
import android.R;
Enter Yourpackages like import com.mypackages.prj;
If you are using eclipse, take a backup of your layout main.xml file and then from the eclipse new file interface create a new "Android XML File" and call it main.xml. copy back from the backup the contents into this new file.
try this.
check your xml files. there might be something wrong in it which is causing R not to build up automatically. To observe such errors, switch your view to Console tab
this is a common error. You need to just search your R.java file in generated section of your project directory in Eclipse. Need to import if the R.java file into the package then import . R;
I hope it will work for you. It was absolutely worked for me...enjoy programming
friends take care that u haven't imported R class, if you have delete "import android.R". The reason is there are two R things one R.java and R.class and we need the java, where we dont need to import rather than referring it. It worked for me and may be to you too.
I found the solution...For me works it
Poject->Properties->Android->Project Build Target (here choose android4.4 or 5.1.1 Android Open Source Project)->Ok
Project->Build All
This function ...
This problem can fix with this process: -
File---->Invalidate cache/restart.
it will restart your android studio and fix that problem

Android: What's happening to R library and/or ADT 14 in Eclipse?

I've just installed the SDK and all the stuff necessary for programming Android in Eclipse for the first time, and I've just find my first problem. After opening a sample project (Snake, for 2.2), there seem to be errors in the code. Well, the R library was not imported. I don't get why it was not already there, but I've imported it. All good? Nope! text = getString(R.string.tie);still has an error. Same with the rest of code (when it uses R). tie is not recognized, it's not shown in that usual blue of Eclipse.
Eclipse says that the problem is ADT 14... final stuff, or switch statements. Ok... I've read that. There's no switch there. That's not the problem. Eclipse suggests me to change .tie to any other thing... like button1. That's not useful, of course. I think the problem is R class, not ADT. Or maybe R class has some final statement so it is not accepted.
I've tried to see if it was that and, in opening the R.class, I get this message: "The source attacement does not contain the source for the file R.class." What now?
R is not a library, it is a resources file, which is generated automatically during the build from existing resources. Just make sure that resources are properly placed where they belong. Then build the project and everything will be OK.
try using project-->clean in eclipse.
if you imported R library remove it. and try again
Make sure you have the required package installed in the AVD Manager. Then, check your Problems view in Eclipse and look at all other errors, other then the R-related ones and make sure everything else is fixed first. If you have an error anywhere in your XML layouts for example, R will not generated.

Categories