6
Jar mismatch Find name of jar in console error and remove that jar from other file from main project and other project by keeping it in only one library project. After that refer the all projects to the project which contain that library by going to property of project Immolator not working Check intel virtual adapter is installed if it is showing installed from sdk manager pls go to folder where intel virtual adapter is present and install it manuallycheck memory size and change memory size in emulator by editing it. Unable to resolve android-x Either download the api of level x or just go to the property of project and change target to any other API that you have Set variables Variable name :JAVA_HOME Variable Value: Java directory Variable name: ANDROID_PLATFORM_TOOLS Variable Value: C:\Users\MOHAMMED\Downloads\adt-bundle-windows-x86_64\sdk\platform- tools Variable name: ANDROID_TOOLS Variable Value: C:\Users\MOHAMMED\Downloads\adt-bundle-windows-x86_64\sdk\tools Variable name: Path Variable Value: %Path%;%ANDROID_PLATFORM_TOOLS%;%ANDROID_TOOLS% Development key hashes: jogsBAGA221Yjf9QnJU0OmZKWTI= command to get it: C:\Users\adm>keytool -exportcert -alias androiddebugkey -keystore C:\Users\adm\. android\debug.keystore | D:\Vinayak\Setup\openssl-0.9.8k_X64\bin\openssl.exe sha 1 -binary | D:\Vinayak\Setup\openssl-0.9.8k_X64\bin\openssl.exe base64

Android Problems and Solution

  • Upload
    vinayak

  • View
    222

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Android Problems and Solution

Jar mismatch

Find name of jar in console error and remove that jar from other file from main project and other project by keeping it in only one library project. After that refer the all projects to the project which contain that library by going to property of project

Immolator not working

Check intel virtual adapter is installed if it is showing installed from sdk manager pls go to folder where intel virtual adapter is present and install it manuallycheck memory size and change memory size in emulator by editing it.

Unable to resolve android-x

Either download the api of level x or just go to the property of project and change target to any other API that you have

Set variables

Variable name :JAVA_HOME

Variable Value: Java directory

Variable name: ANDROID_PLATFORM_TOOLS

Variable Value: C:\Users\MOHAMMED\Downloads\adt-bundle-windows-x86_64\sdk\platform-tools

Variable name: ANDROID_TOOLS

Variable Value: C:\Users\MOHAMMED\Downloads\adt-bundle-windows-x86_64\sdk\tools

Variable name: Path

Variable Value: %Path%;%ANDROID_PLATFORM_TOOLS%;%ANDROID_TOOLS%

Development key hashes:

jogsBAGA221Yjf9QnJU0OmZKWTI=

command to get it:

C:\Users\adm>keytool -exportcert -alias androiddebugkey -keystore C:\Users\adm\.

android\debug.keystore | D:\Vinayak\Setup\openssl-0.9.8k_X64\bin\openssl.exe sha

1 -binary | D:\Vinayak\Setup\openssl-0.9.8k_X64\bin\openssl.exe base64

Enter keystore password: android

We want to install open ssl first and java bin in the system variable to work keytool command

res\drawable-xhdpi-v4\ic_plusone_small_off_client (1).png: Invalid file name: must contain only [a-z0-9_.]\

Page 2: Android Problems and Solution

actual problem is images in resource become twice and so that they are rename second image ending with (1)

delete repeated files

can not resolve R

it may occure due to eclips try to manage imports, R is created automatically when you build project

then check for the /res directory and there must be some file that have some error in it and that is preventing the application from being built. For example, it may be a layout file or it may be due to some missing resource is, but you already defined it in the XML file.

If you have any additional, even unused (!) or unreferenced (!) images in a folder like res/drawables-mdpi which do not comply to the file naming conventions (may contain only [a-z0-9_.]), the R.java class might not generate, causing the chain of events all the other posts referred to. Hope it helps!

R.java is a file that the Android Eclipse plugins creates while building your application. R.java is created under the "gen" directory. This file is generated from the information in the "res" directory. If you run select "Project" -> "Clean..." on the Eclipse menu, it will remove and then regenerate the R.java file.

The problem "R cannot be resolved" happens when you change your package name in the AndroidManifest.xml file. It uses your Android package name to create a subdirectory under the "gen" directory where it stores the R.java file.

Eclipse may have problems executing clean, because it is confused about where the R.java file is when you have changed the Android package name. You can either rename the subdirectory under gen to match your new package name, or you can change your package name back to the old name. Do the clean and then change the package name to the new name you want. This works best if you stop Eclipse from trying to build while you are changing the package name. Under the "Project" menu uncheck the option to "Build Automatically" and also when the "Clean..." dialog asks if it should "Start a build immediately" uncheck the box so it doesn't try to build while you are changing the package name. After you have changed the name you can turn "Build Automatically" back on again.

Note that if your AndroidManifest.xml file package name does not match your Java package name, Eclipse will end up automatically adding an "import <your Android package name>.R;" line in all your .java files that have any references to R. If you change your AndroidManifest.xml package name, sometimes Eclipse does not update all of these added imports. If that happens, use the Eclipse refactoring (ALT + Shift + R) to change the import statement in one of your Java files to your new AndroidManifest.xml package name. It is best to do this while you have disabled "Build Automatically".

INSTALL_FAILED_NO_MATCHING_ABIS when install apk

INSTALL_FAILED_NO_MATCHING_ABIS is when you are trying to install an app that has native libraries and it doesn't have a native library for your cpu architecture. For example if you compiled an app for armv7 and are trying to install it on an emulator that uses the Intel architecture instead it will not work

Error dialog from play service util not working

Add library by build path to play service library

Page 3: Android Problems and Solution

Attribute already exist error of supportv4 librray project

Delete support project and keep only appcompactv4 project

Facebook button class not intilize error

Restart the IDE

Error at token ‘;” ,, expected

Check have you trying to access view by findViewById before setting layout to activity.

Problem in customizing facebook login button

Add this in lay out file to disable textfb:login_text=""fb:logout_text=""

add this item on button object to chabge bg image and more

authButton = (LoginButton) view.findViewById(R.id.authButton);authButton.setBackgroundResource(R.drawable.icon);authButton.setText("Login");//not workingauthButton.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);//to hide default icon

android.os.networkonmainthreadexception

you cannot run network related task on UI thread…use Asynk task to do this.

FB pic not getting—major issue faced yet

Solution : use hhtps instead of http in url

Comment at solution site:

I suspect, that SDK is not blame and the problem is in redirection. Try to open link "graph.facebook.com/USER_UID/picture"; in browser - the link "httpS://fbcdn-profile-a.akamaihd.net/..."; will be opened. Auto redirection works automatically when original and redirected protocols are same. So, try to load images from "httpS://graph.facebook.com/USER_UID/picture"; and make sure, that HttpURLConnection.setFollowRedirects(true) or conn.setInstanceFollowRedirects(true) is called. Then BitmapFactory.decodeStream will work again.

Extra info regarding it: This should solve it. but be sure to access setfollowredirects statically i.e HttpURLConnection.setFollowRedirects(HttpURLConnection.getFollowRedirects());

Page 4: Android Problems and Solution

Java.object.lang not found

1. Right click on project > Build path > configure build path...2. Select the Libraries tab, you should see the Java 1.8 jre with an error3. Select the java 1.8 jre and click the Remove button4. Add Library... > JRE System Library > Next > workspace default > Finish5. Click OK to close the properties window6. Go to the project menu > Clean... > OK

No resource identifier found for attribute 'adSize' in package 'com.google.example' main.xml

replace /res/ with /lib/ in your custom layout nampespace xmlns:android="http://schemas.android.com/apk/res/android" will be

xmlns:yourApp=http://schemas.android.com/apk/lib/com.yourAppPackege.yourClass

asyntask : always use array to get parameter from argument

Sometime web service work well when called at alone but when we call it with other device it will not work

Solution : the problem is that when you call it alone it executed in jre installed on local machine but when you call it from other device it generally execute in server envelop.

When we use external lib in project we add them in lib folder of project but server unable to read it in that case you should add all this jar in WEB-INF>lib folder of your project

Also try to by adding jar in server>tomcat>lib folder

If resources are unable to generate that means id given to particular view is unable to resolve in java code pls check error in problems tab and console to find root of problem

To maintain insertion order ini map use linked hash map. It is use full in expandable list view.

Page 5: Android Problems and Solution

Android StudioP: Compile() not found while build.

S:check spell of compile in gradle file.