Android Studio with Google Play Services -


i'm trying test google play services new android studio. have project dependency google_play_services.jar. when try rebuild project following errors:

information:[tstgp3-tstgp3] crunching png files in source dir: c:\users\ans\androidstudioprojects\tstgp3\tstgp3\src\main\res information:[tstgp3-tstgp3] destination dir: c:\users\ans\androidstudioprojects\tstgp3\build\classes\res-cache\tstgp3-tstgp3 information:compilation completed 2 errors , 0 warnings in 2 sec information:2 errors information:0 warnings c:\users\ans\.androidstudiopreview\system\compiler\tstgp3.3f17bd41\.generated\android_buildconfig_generator\tstgp3-tstgp3.74fc5b25\production\com\example\tstgp3\buildconfig.java     error:error:line (4)error: duplicate class: com.example.tstgp3.buildconfig c:\users\ans\.androidstudiopreview\system\compiler\tstgp3.3f17bd41\.generated\aapt\tstgp3-tstgp3.74fc5b25\production\com\example\tstgp3\r.java     error:error:line (10)error: duplicate class: com.example.tstgp3.r 

it seems has 2 buildconfig files , 2 r classes. how can resolve issue?

edit:

i have noticed compiler compiles 2 r.java files: 1 in project folder , 1 located in folder %userprofile%.androidstudiopreview so, tried exclude "preview" folder in compiler settings , it's working. issue occurs after have started use google play services classes in project. appreciate if can explain reason behind problem.

all answers wrong, since release of gradle plugin v0.4.2 setup of google play services under android studio straight forward. don't need import jar or add project library nor add new module under android studio. have add correct dependencies build.gradle file. please take links: gradle plugin v0.4.2 update, new build system, , this sample

the correct way follows:

first of have launch sdk manager , download , install following files located under "extras": android support repository, google play services, google repository.

restart android studio , open build gradle file. must modify build.gradle file under dependencies:

dependencies {     compile 'com.google.android.gms:play-services:6.5.87'   } 

and syncronise project (the button left of avd manager).

since version 6.5 can include complete library (very large) or modules need (best option). i.e if need google maps , analytics can replace previous example following one:

dependencies {       compile 'com.google.android.gms:play-services-base:6.5.87'         compile 'com.google.android.gms:play-services-maps:6.5.87'   } 

you can find complete dependency list here

some side notes:

  • use latest play services library version. if it's old version, android studio highlight it. of today (february 5th 6.5.87) can check latest version @ gradle please
  • after major update of android studio, clean rebuild project following next instructions suggested in comments @user123321

    cd project folder
    ./gradlew clean
    ./gradlew build


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -