I have created an Android app in that when I imports Google Play Services library it removes R.java file.
I had clean and build the project and also restarts the eclipse but can't get the R.java file.
How to solve this problem?
Thanks.
As mentioned here : https://developer.android.com/google/play-services/setup.html#Setup
Here's different steps to proceed for setting up Google Play Services :
Copy the library project at /extras/google/google_play_services/libproject/google-play-services_lib/ to the location where you maintain your Android app projects.
Import the library project into your Eclipse workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.
In your app project, reference Google Play services library project. See Referencing a Library Project for Eclipse for more information on how to do this.
Note: Don't forget to copy the library to your development workspace :
check your resource file error.
after solving your resource xml file error remove import android.R; from your java file and import com.your.package.name.R; in your java
Finally I got the solution myself.
I just changed the android:minSdkVersion="8" to android:minSdkVersion="14" in AndroidManifest.xml file and problem solved.
Thanks.
Related
when i import google play service into my ecplise it shows error in appinvite_style.xml file
Error Location : res->values-v21->appinvite_styles.xml
<!-- Base preview application theme. -->
<style name="Theme.AppInvite.Preview.Base" parent="#android:style/Theme.Material.Light.DialogWhenLarge.NoActionBar"/>
appinvite_styles.xml
and also i tried to import appcomport-v7 but it throws the error in that folder too.
API Level :19 (4.2.2)
thanks in advance
The important thing in adding a library in eclipse is to remember that your project and the library project need to be in the same workspace.
To solve this follow below ways,
You can copy the google-play-services library project to the same workspace where your main project is there.
else
While importing the library to eclipse remember to check copy projects into workspace which will add a copy of the library to your workspace.
Please refer this:
eclipse android can not import google play services library
hello i am quite new to Android development and i want to learn how to use the google Maps API v2. After trying numerous tutorials, i always seem to have a problem with the google play services library. Somehow, Eclipse can't import it properly. I tried this tutorial https://github.com/thecodepath/android_guides/wiki/Google-Maps-Fragment-Guide and when i try to include Google Play Services project as a library, first it all goes nice and smooth, i get a green tick in the Project Properties - Android - Library window, but when i close it i still get lots of "can't be resolved to a type" errors. I return to the window where i add the library and i see a red "X" and a question mark under "project" instead of the green tick. I tried several other tutorials and i always have a problem with this library. I like this tutorial and i would really like to make it work. I also tried to manually copy the library folder in the workspace but that didn't work either. I googled like crazy trying to find an answer but i always find something that i tried before (like manually copying the library in the workspace or something similar). I am quite desperate, i really have no idea why it can't just see the library please help. Also this is my first post to StackOverflow so be gentle :)
later Edit (solved):
when i imported the downloaded project, i kept it on the desktop and thats why it didn't work, after i copied it in the workspace everything worked. Thank you all very much for helping a beginner :)
The important thing in adding a library in eclipse is to remember that your project and the library project need to be in the same workspace.
To solve this follow below ways,
You can copy the google-play-services library project to the same workspace where your main project is there.
else
While importing the library to eclipse remember to check copy projects into workspace which will add a copy of the library to your workspace.
I see a red "X" and a question mark under "project" instead of the
green tick.
The problem is -
The path to your google play services library is not same as the path to your project. It is outside of your project. And so is not recognized by simple import.
Solution - Put the library in the project's libs folder.
NOTE: Just putting the library to the libs folder is not enough.
After you added your library follow these steps -
1) Go to Project -> Properties -> Java Build Path -> Libraries -> Add JARs..
2) Now add your recently added jar to the build path from JAR selection process.
3) Go to Project -> Properties -> Java Build Path -> Order and Export.
4) Put a tick mark in the check box against this library name and press OK.
5) Do Project -> Clean.
if your giving google-Play-Service-lib as a references to your project , try to keep your project and the Google-play services lib should be in same drive.
if your project is on C: drive means place Google-play-services-lib in C:
While making the copy of the entire folder libproject containing google-play-services_lib from eclipse import project by selecting the copied libproject folder in your working place.
For the rest follow the steps in Setting Up Google Play Services
Eclipse
Copy the library project at
<android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/
to the location where you maintain your Android app projects.
Import the library project into your Eclipse workspace. Click
File > Import, select Android > Existing Android Code into Workspace
and browse to the copy of the library project to import it.
After you've added the Google Play services library as a dependency for your app project, open your app's manifest file and add the following tag as a child of the <application> element:
< meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Android Studio
Open the build.gradle file inside your application module directory.
Add a new build rule under dependencies for the latest version of play-services
eg
...
dependencies {
compile 'com.google.android.gms:play-services:9.2.0'
}
apply plugin: 'com.android.application'
Source developers.google.com
I am working in Google App Indexing for my project.
Newbee for this feature. I just following the google guide lines.
Notify the google using API
In this page,asked to create an instance of GoogleApiClient. I tried but getting "GoogleApiClient cannot be resolved a type" error.
And I have added the following libraries into my project.
1.Google play services
2.Google api client
3.Google http api client
and
the error is
How can I resolve this error?
Copy the library project at /extras/google/google_play_services/libproject/google-play-services_lib/ to the location where you maintain your Android app projects (your projects folder).
Import the library project into your Eclipse workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it (browse to the google-play-services_lib folder).
In your app project, reference Google Play services library project (right click on project, Properties, Android, click on Add..., select google-play-services_lib folder).
After you've added the Google Play services library as a dependency for your app project, open your app's manifest file and add the following tag as a child of the element (this is a new requirement as of updated Google Play Services):
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Then add this statement in your class (or fix the error):
import com.google.android.gms.common.api.GoogleApiClient
For Android Studio, follow directions here:
https://developers.google.com/android/guides/setup
If you update SDK all...
Remove "google-play-services.jar" in libs directory.
Import google-play-services_lib project in SDK ([your-sdk]\extras\google\google_play_services\libproject\google-play-services_lib)
Click your Project > Right Click > Properties > Click Android > Click [Add] button in the Library section and add google play library.
And... Fix the Red alerts(?) :)
I hope this helps you...
im'triyng to implement the Google Licensing Verification in a Android Studio made app.
By following this lines: http://developer.android.com/google/play/licensing/setting-up.html seems tath:
As an alternative to adding the LVL as a library project, you can copy the library sources directly into your application. To do so, copy (or import) the LVL's library/src/com directory into your application's src/ directory.
I've done this but the import of:
import com.google.android.vending.licensing.LicenseChecker;
import com.google.android.vending.licensing.LicenseCheckerCallback;
fail..
Searching on google i've been noticed that i need to modify the build.grade file on my project, but i can't find a specific solution.
How can I reference the LVL in my android studio project?
There is some tutorial or example?
Thanks
Lorenzo
In Android Studio, Tools-Android-SDK Manager
In SDK Manager, in the extras section choose Google Play Licensing Library
Go back to Android Studio, and choose File-New-Import Module
ADK Manager will have put the downloaded files under your SDK directory, in my case Desktop/android-sdk-macosx/extras/google/play_licensing/library
Choose to import this directory as a module, and give it a name. I used 'lvl'
Optionally change targetSdkVersion in the lvl module's build.gradle to match your project targetSdkVersion.
Then in your projects build.gradle, add the line compile project(':lvl') inside the {dependencies{ section.
Re-sync Gradle and everything should compile correctly.
Finally I've got the solution!
You have to put the library/src/com directories in the youroject/scr/main/java/com and then click on the "Sync project with Gradle files" button.
step 6 is placed in
inside the project(":android"){dependencies { section.
Copying the LVL sources to your application.
As an alternative to adding the LVL as a library project, you can copy the library sources directly into your application. To do so, copy (or import) the LVL's library/src/com directory into your application's src/ directory.
Visit:http://developer.android.com/google/play/licensing/setting-up.html
I can't build the sample game TypeANumberChallenge provided by Google (see GitHub). Got the following error message:
The project was not built since its build path is incomplete. Cannot find the class file for com.google.android.gms.games.GamesClient. Fix the build path then try building this project
The type com.google.android.gms.games.GamesClient cannot be resolved. It is indirectly referenced from required .class files MainActivity.java /TypeANumber/src/com/kerrywei/games/tanc
I did include the project library BaseGameUtils and google-play-services-lib as described by readme and Google Play Services Guides, but still got the error, and can't just compile...
Update:
I tried to remove TypeANumberChallenge and redo the whole process and got a new error when trying to add BaseGameUtils as library:
An internal error occurred during: "Android Library Update".
Path must include project and resource name: /BaseGameUtils
Problem solved by reading Google Play Services Guides
Make a copy of the Google Play services library project. Copy the library project at
<android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/
to the location where you maintain your Android app projects. If you
are using Eclipse, import the library project into your workspace.
Click File > Import, select Android > Existing Android Code into
Workspace, and browse to the copy of the library project to import it.
You CANNOT use the lib project in SDK folder DIRECTLY...
What a joke..