How android determines required permissions

http://stackoverflow.com/questions/30546197/android-studio-adds-unwanted-permission-after-running-application-on-real-device

If you still wind up with permissions that you do not want, then you will need to determine where the permissions are coming from. There should be a manifest merger report in build/outputs/logs/ of your module.

Advertisements

New AlertDialog library with appCampat v22.1

http://stackoverflow.com/questions/26455919/material-design-not-styling-alert-dialogs

http://developer.android.com/reference/android/support/v7/app/AlertDialog.html

 

<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
     <item name="colorAccent">#5fa3d0</item>
     <item name="android:textColorPrimary">#000000</item>
     <item name="android:background">#FFFFFF</item>
</style>
 
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.AppCompatAlertDialogStyle);
     builder.setTitle("Titttle");
     builder.setMessage("Yap, Message");
     builder.setPositiveButton("OK", null);
     builder.setNegativeButton("Cancel", null);
     builder.show();

For this, make sure you have following (v22 or higher) in build.gradle

dependencies {
    compile 'com.android.support:appcompat-v7:23.2.1'
}

How to setup license verification library

http://stackoverflow.com/questions/18449680/setting-up-the-licensing-verification-library-on-android-studio

  1. In Android Studio, Tools-Android-SDK Manager
  2. In SDK Manager, in the extras section choose Google Play Licensing Library
  3. Go back to Android Studio, and choose File-New-Import Module
  4. ADK Manager will have put the downloaded files under your SDK directory, in my case Desktop/android-sdk-macosx/extras/google/play_licensing/library
  5. Choose to import this directory as a module, and give it a name. I used ‘lvl’
  6. Optionally change targetSdkVersion in the lvl module’s build.gradle to match your project targetSdkVersion.
  7. Then in your projects build.gradle, add the line compile project(':lvl') inside the {dependencies{ section.
  8. Re-sync Gradle and everything should compile correctly.

Two Android Studio Projects, Library & Application – How to link them.

Prepare two projects as follows

1. Library

LibraryProject
+ LibraryModule

2. Application

ApplicationProject
+ ApplicationModule

Set the dependency relations as follows

1. In LibraryProject

in “build.gradle” inside your LibraryModule folder,
make sure to set it as library using plugin and disable proguard

apply plugin: 'com.android.library'
:
:
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
    }
}

2. In ApplicationProject

in “settings.gradle”

include ':ApplicationModule', '..:LibraryProject:yourLibraryModule'

in “build.gradle” inside your ApplicationModule folder

apply plugin: 'com.android.application'
:
:
compile project(':..:LibraryProject:yourLibraryModule')

Reference:

http://stackoverflow.com/questions/22243269/how-to-share-a-single-library-source-across-multiple-projects

http://stackoverflow.com/questions/20117884/android-studio-app-with-library-project-fails-to-build