Top Menu

Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Wednesday, 20 January 2016

How to get SHA1 fingerprint key

Go to your java bin directory via the cmd:
C:\Program Files\Java\jdk1.7.0_71\bin>
Now type in the below command in your cmd:
keytool -list -v -keystore c:\users\your_user_name\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android
example:
keytool -list -v -keystore c:\users\prince\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android
and you will get SHA1
Make sure you are in BIN folder of jdkX.X.X_XX(mine folder name is jdk1.7.0_71) , or else if you don't know what folder name you have then find it by opening java folder and you will see what folder name is but you must be in your BIN folder and then run this command. 
SNAPSHOT:

Read more...

How to switch from C drive to D drive in cmd

Here is very simple method to change the drive, follow as shown below on command prompt.

C:\>cd /d "D:\"
D:\>cd /c "C:\"
The filename, directory name, or volume label syntax is incorrect.
D:\>
Read more...

Tuesday, 12 January 2016

Android debug.keystore password

Hey Folks!!

If you forget your android debug.keystore password !!

Don't you worry now, here is the solution for it.

Keystore name: "debug.keystore"
Keystore password: "android"
Key alias: "androiddebugkey"
Key password: "android"
CN: "CN=Android Debug,O=Android,C=US"

If you want to configure them in gradle then it should be look like this

signingConfigs {
        debug {
            storeFile file('PATH_TO_HOME/.android/debug.keystore')
            storePassword 'android'                   
            keyAlias 'AndroidDebugKey'
            keyPassword 'android'                     
        }
        ...
}
Read more...

Thursday, 3 December 2015

"Failed to create jvm, error code - 4" Android Studio

Hi Friends,

If you are facing this problem
failed to create jvm error code -4 JVM Path: C:\Program Files\Java\jdk1.7.0_45\jre If you already have a 32-bit JDK installed, define a JAVA_HOME variable in Which is not solved.

Then here is the solution:

Go to C:\Program Files\Android\Android Studio\bin\studio.exe.vmoptions

or open the path where you have installed your Android Studio and open the "studio.exe.vmoptions" file in Notepad or Notepad++.




Open it in Notepad or Notepad ++ and change the following attributes

-Xmx512m to -Xmx256m

-XX:MaxPermSize=250m to -XX:MaxPermSize=128m

OR

-Xmx750m to -Xmx512m

-XX:MaxPermSize=350m to -XX:MaxPermSize=250m
Read more...

Thursday, 26 November 2015

Cannot resolve symbol HttpGet,HttpClient,HttpResponce in Android Studio

Today I was facing this issue "Cannot resolve symbol DefaultHttpClient" while parsing JSON in my application.

So Friends!! if you are also facing or will face the same issue then I'm giving you the solution for it. HttpClient was deprecated in API Level 22 and removed in API Level 23, You have to use URL Conntection. If you need SDK 23, add this to your gradle:

android {
    useLibrary 'org.apache.http.legacy'
}

Please remove all jar files of Http from libs folder and add below dependencies in gradle file:

compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'org.apache.httpcomponents:httpcore:4.4.3'


Read more...

Friday, 30 October 2015

Gradle Sync problem - failed to sync Gradle project

Hello guys!!

You may face this sync Gradle project when upgrade the Android Studio or low heap size like this





So here is the solution for it.

For Android Studio 1.3 : (Method 1)
Step 1 : Open gradle.properties file in your Android Studio project.
Step 2 : Add this line at the end of the file
org.gradle.jvmargs=-XX:MaxHeapSize\=256m -Xmx256m Above methods seems to work but if in case it won't then do this (Method 2)
Step 1 : Start Android studio and close any open project (File > Close Project).
Step 2 : On Welcome window, Go to Configure > Settings.
Step 3 : Go to Build, Execution, Deployment > Compiler
Step 4 : Change Build process heap size (Mbytes) to 1024 and Additional build process to VM Options to -Xmx512m.
Step 5 : Close or Restart Android Studio.
Read more...

Monday, 26 October 2015

Display HTML format text in WebView

I have faced this problem to show the HTML format text show in WebView
I found the solution for this and lets share it -

Create a xml with WebView
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:orientation="vertical"
    tools:context=".MainActivity" >

    <WebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

</LinearLayout>

Now create the Activity
package com.example.androidhtmltextsample;

import android.os.Bundle;
import android.app.Activity;
import android.webkit.WebView;

public class MainActivity extends Activity {

 WebView webView;
 
 String mimeType = "text/html";
 String encoding = "utf-8";
 String htmlText = "<ul>\n<li>Apple cider vinegar dries acne without causing any apparent discomfort.</li>" +
        "\n<li>Another interesting acne overnight treatment is the application of toothpaste.</li>" +
        "\n<li>Follow this up by applying a bit of alcohol over the affected area just prior to bedtime.</li>" +
        "\n<li>Do not apply gel based toothpastes on the affected areas.</li>\n</ul>";
 
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  
  webView = (WebView)findViewById(R.id.webview);
  webView.loadData(htmlText, mimeType, encoding);
 }

}




Now add the Internet Permission in Menifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"    
package="com.example.androidhtmltextsample"    
android:versionCode="1"    
android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="8"        
              android:targetSdkVersion="23" />

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

    <application android:allowBackup="true"        
                 android:icon="@drawable/ic_launcher"        
                 android:label="@string/app_name"       
                 android:theme="@style/AppTheme" >
        <activity android:name="com.example.androidhtmltextsample.MainActivity"         
                  android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        
    </application>

</manifest>

Read more...