Compilation error in Android Studio When making a simple Google Android Maps API v2 project -


recently migrated new android studio ide based on intellij

the guides followed were:

  1. https://developers.google.com/maps/documentation/android/start (for basics)

  2. how can create android application in android studio uses google maps api v2? (for importing required google play services , support libraries android studio)

all libraries detected android studio , didn't 'library not found errors'. project shown error free. when tried compile got error.

gradle:  failure: build failed exception.  * went wrong: execution failed task ':aid-amritainfodesk:compiledebug'. > compilation failed; see compiler error output details.  * try: run --stacktrace option stack trace. run --info or --debug option more log output.   not execute build using gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'. 

this explorer.java file

package com.aid.explorer;  import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.supportmapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.markeroptions;  import android.os.bundle; import android.support.v4.app.fragmentactivity;   public class explorer extends fragmentactivity {      private googlemap mmap;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.explorer);         setupmapifneeded();     }      @override     protected void onresume() {         super.onresume();         setupmapifneeded();     }       private void setupmapifneeded() {         // null check confirm have not instantiated map.         if (mmap == null) {             // try obtain map supportmapfragment.             mmap = ((supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.map))                     .getmap();             // check if successful in obtaining map.             if (mmap != null) {                 setupmap();             }         }     }       private void setupmap() {         mmap.addmarker(new markeroptions().position(new latlng(0, 0)).title("marker"));     } } 

and explorer.xml file

<?xml version="1.0" encoding="utf-8"?> <fragment xmlns:android="http://schemas.android.com/apk/res/android"           android:id="@+id/map"           android:layout_width="match_parent"           android:layout_height="match_parent"           class="com.google.android.gms.maps.supportmapfragment"/> 

i know went wrong. greatly appreciated

i following same instructions except creating new project. under project structure removed android-gradle facet , able build successfully. optionally 1 can update gradle build files , add android-gradle facet play services library.

note: changed name of google play services directory.

build.gradle google play services library.

apply plugin: 'android-library'  buildscript {     repositories {         mavencentral()     }      dependencies {         classpath 'com.android.tools.build:gradle:0.4'     } }  dependencies {     compile files('libs/android-support-v4.jar')     compile files('google-play-services.jar') }  android {     compilesdkversion 17     buildtoolsversion '17.0.0'      sourcesets {         main {             manifest.srcfile 'androidmanifest.xml'             java.srcdirs = ['src']             resources.srcdirs = ['src']             aild.srcdirs = ['src']             renderscript.srcdirs = ['src']             res.srcdirs = ['res']             assets.srcdirs = ['assets']         }     } } 

build.gradle test app.

buildscript {     repositories {         maven { url 'http://repo1.maven.org/maven2' }     }     dependencies {         classpath 'com.android.tools.build:gradle:0.4'     } } apply plugin: 'android'  dependencies {     compile files('libs/android-support-v4.jar')     compile project(':lib-google-play-services')     compile files('../lib-google-play-services/libs/google-play-services.jar') }  android {     compilesdkversion 17     buildtoolsversion "17.0.0"      defaultconfig {         minsdkversion 11         targetsdkversion 16     } } 

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 -

CSS3 Transition to highlight new elements created in JQuery -