Category Archives: Android Studio

1,003 views

Who has higher priority build.gradle or AndroidManifest Android Studio

build.gradle in module have higher priority then AndrodiManifest.xml Try this. AndroidManifest.xml have code: <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="23" /> build.gradle have code: defaultConfig { applicationId "cz.okhelp.words" minSdkVersion 9 targetSdkVersion 19 versionCode 107 versionName "1.0.7" } Warning in AndroidManifest.xml: This targetSdkVersion value (23) … Continue reading

Posted in Android Studio, Bugs, warnings, errors | Tagged | Comments Off on Who has higher priority build.gradle or AndroidManifest Android Studio
814 views

App have transparent menu Android

If the app have transparent menu and you do not want this, try delete @style/AppTheme in application tag in AndroidManifest.xml and try run module – project. If menu is not transparent , maybe it caused <application android:allowBackup="true" android:icon="@drawable/dicts_ico" android:label="@string/app_name" android:theme="@style/AppTheme" … Continue reading

Posted in Android Examples Code, Android Studio, Bugs, warnings, errors | Tagged | Comments Off on App have transparent menu Android
835 views

How rebuild only one module in project Android Studio

If you do click on Rebuid project menu item, this operation maybe consume long time on slovly PC. Some errors dismis when you do rebuild project, or module. Try this: Select module where contains red error code and press Debugg … Continue reading

Posted in Android Studio, Bugs, warnings, errors | Comments Off on How rebuild only one module in project Android Studio
785 views

Android Studio gradle file comment same as java comment

// single line /* multi line */

Posted in Android Examples Code, Android Studio | Comments Off on Android Studio gradle file comment same as java comment
809 views

Save Instance State if device is rotated

Try this trick. In AndroidManifest – activity tag write this code android:configChanges=”keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize” App hold data of a views if will to rotation of device. <activity android:name=".Tests_Activity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

Posted in Android Examples Code, Android Studio | Tagged | Comments Off on Save Instance State if device is rotated
1,059 views

Resources NotFoundException: File res/drawable/abc_btn_radio_on_mtrl.xml

If you make a new RadioButton and gradle istruction have compile ‘com.android.support:appcompat-v7:23.2.0′ try to change RadioButton into AppCompatRadioButton (context); RadioButton rb = new AppCompatRadioButton (context);

Posted in Android Studio, Bugs, warnings, errors | Tagged | Comments Off on Resources NotFoundException: File res/drawable/abc_btn_radio_on_mtrl.xml
2,278 views

No executable code found at line – omits breakpoints

No executable code found at line …. Try one from this solution: 1.) uninstall app from test device, try to debugg app or 2.) open module gradle file and set minifyEnabled to false in debug condition debug { minifyEnabled false … Continue reading

Posted in Android Studio, Bugs, warnings, errors | Tagged | Comments Off on No executable code found at line – omits breakpoints
880 views

Interstitial ads admob onCreate Android example code

private InterstitialAd mInterstitialAd; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);     //Caused by: java.lang.IllegalStateException: The ad unit ID must be set on InterstitialAd before loadAd is called. mInterstitialAd = new InterstitialAd(this); mInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712"); // Put your number!!!!   // some … Continue reading

Posted in Android Examples Code, Android Studio | Comments Off on Interstitial ads admob onCreate Android example code
912 views

Proguard Android Studio

http://developer.android.com/tools/help/proguard.html If make signed apk, open file build.gradle in the module folder. Set minifyEnabled to true http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Running-ProGuard buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile(’proguard-android.txt’), ‘proguard-rules.pro’ } } Check if the file exists in the module folder proguard-rules.pro c:\Users\meFolder\AndroidStudioProjects\MyProject\myModule\proguard-rules.pro Android … Continue reading

Posted in Android Studio | Tagged | Comments Off on Proguard Android Studio
690 views

Imported module not visible in project explorer Android Studio

Imported module not visible in project explorer Android Studio but exist in project folder. Gradle sync failed: Cause: failed to find target with hash string ‘android-20′ in: C:\Users\jas\AppData\Local\Android\sdk android-20 is for example! Open file in existing module named build.gradle is … Continue reading

Posted in Android Studio, Bugs, warnings, errors | Tagged | Comments Off on Imported module not visible in project explorer Android Studio