Skip to main content

Featured

Android studio “SDK tools directory is missing”

Following 2 possible solutions will resolve this problem :  Solution1 : To fix the problem, it was required that I list the path to my corporate PAC file by using  Configure -> "Appearance and Behavior" -> System Settings -> HTTP Proxy . I selected "Automatic proxy configuration url:" Delete your  ~/.Android*  folders (losing all of your settings :/). Run Android Studio. It will show you a welcome wizard where it tries to download the SDK again (and fails due to my rubbish internet). Click the X on the wizard window. That will enable you to get to the normal welcome dialog. Go to Settings->Project Defaults->Project Structure and change the Android SDK location to the correct one. Solution 2 : To fix the problem, it was required that I list the path to my corporate PAC file by using  Configure -> "Appearance and Behavior" -> System Settings -> HTTP Proxy . I selected "Automatic proxy configuration url:&quo

implement maps with google maps library project in AndroidStudio

Import Library project:
  1. Open your project in Android Studio
  2. Download the library (using Git, or a zip archive to unzip)
  3. Go to File > Import Module and import the library as a module
  4. Go to File > Project Structure > Modules
  5. Locate your main project module, click on it. It should have a few android libraries such as support-v4 etc.
  6. Click on the more on the left green "+" button > Module dependency
  7. Select "Freemium Library" (not Freemium Library Project)

Google map implementation flow:
http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/
http://www.vogella.com/tutorials/AndroidGoogleMaps/article.html
http://www.tutorialspoint.com/android/android_google_maps.htm

Which plugin need to use in build.gradel :
In projLib's build.gradle file, you'll see a statement like this:
apply plugin: 'com.android.application'
which tells Gradle to build it as an application, generating an APK. If you change it to this:
apply plugin: 'com.android.library'
it will build as a library, generating an AAR, and it should work.
If you also need projLib to generate a separate APK, then you'll have to do some refactoring to pull the common code that you need out into a third library module, and have both APKs depend on it.
Libraries aren't allowed to set an applicationId, so if you see an error message to that effect, remove it from the library's build script.

And Importantly for maintaining the code for build.gradel in AndroidStudio :

/app/build.gradel :
apply plugin: 'com.android.application'
android {
    compileSdkVersion 22    buildToolsVersion "22.0.1"
    defaultConfig {
        applicationId "com.example.cartravels"        minSdkVersion 9        targetSdkVersion 19    }
    buildTypes {
        release {
            minifyEnabled false            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt        }
    }
}
dependencies {
    compile 'com.android.support:support-v4:19.0.0'    compile project(':libraries:google-play-services_lib')
}


/libraries/google-play-services_lib/build.gradel :
apply plugin: 'com.android.library'
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'}
repositories {
    mavenCentral()
}
android {
    compileSdkVersion 22    buildToolsVersion "22.0.1"
    defaultConfig {
        minSdkVersion 9        targetSdkVersion 19    }
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
    }
}


CarTravels/build.gradel :
// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'    }
}
allprojects {
    repositories {
        jcenter()
    }
}

CarTravels/settings.gradel :
include ':app'include ':libraries:google-play-services_lib'

Comments