Using the Android development tool Eclipse, there have been a lot of problems, summed up, come out together to learn:
Issue 1, this Android SDK requires Android Developer Toolkit version 20.0.0 or above ...
* In the Plugin.prop file under the Android_sdk_windows/tools/lib
#begin Plugin.prop
plugin.verson=20.0.0
#end Plugin.prop
Change to:
#begin Plugin.prop
plugin.verson=18.0.0 (where the 18.0.0 is your current ADT version)
#end Plugin.prop
question 2:r cannot is resolved to a variable.
* Program one system automatically added import Android. R this statement, as long as you delete this statement on the line.
Scenario Two layout file there is a. Out XML file, delete this XML file, and then put the project clean down on it.
issue 3:error opening trace file:no such file or directory.
This is mainly due to the version inconsistency of the Android API and the emulator (or phone). The project and the simulator are changed to the same version, will not error.
question 4:final Exception:main
Java.lang.RuntimeException:Unable to instantiate activity componentinfo{
com. project name. The package name. Entry activity name}:JAVA.LANG.CLASSNOTFOUNDEXCEPTION:COM.CHAPTER4LAYOUT3. Entry activity name .
Cause Analysis:
The "Entry activity name" set in Androidmanifest.xml is not the activity mentioned above, that is, the system cannot find the entry to the activity, so the program cannot run naturally.
<activity
Android:name = "com.chapter4layout3.ExpanListViewDemoActivity (entry activity) from the following main know is the entry activity, The activity that you want to run must be this name "
Android:label = "label" = "@string/app_name" >
<intent-filter>
<action android:name = "Android.intent.action.MAIN"/>
<category android:name= "Android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
Question 5:
Android-"Bitmap too large to being uploaded into a texture"
When this problem occurs, you can change the hard acceleration to false, that is, add the following statement to the application of the manifest file:
Android:hardwareaccelerated= "False" can be displayed.
Question 6:
' adb server didn ' t ACK ' (the connection to ADB was down, and a severe error had occured.)The solution:
In general 1. Shut down all Adb.exe on the Task manager first, and restart Eclipse to resolve it. But if this doesn't work, you can try it:
1. Close the eclipse first.
2. Under Platform-tools of the manager station to your Android SDK, type adb kill-server, if ADB is closed it will prompt server not running *
3. Type adb start-server if it is unsuccessful, it will prompt daemon not running.starting it is on port * *, and if it succeeds without prompting any statements, this is re-opening eclipse to function properly.
In another case, a pea pod was opened, causing a port conflict.
My problem is that the USB cable really started to have a problem, not connected to the phone, so the ADB ran up and then disappeared. ⊙﹏⊙ b Khan.
Question 7:
Unable to start activity componentinfo (.... secondactivity) Java.lang.NullPointerException:
Null pointer exception:
The main cause of the null pointer exception:
1, when an object does not exist and call its method will produce this exception Obj.method ()//obj object does not exist (such as an object str you do not assign a value, but call it will appear null pointer exception).
2. An exception occurs when accessing or modifying a field that does not exist for an object Obj.method () The//method method does not exist.
My problem is r.id.button01 because of carelessness written r.layout.secondactivity so that can not find that button01, so there will be null pointer exception.
Null pointer workaround:
Focus on the row where the error occurred, and diagnose the specific error with the two main causes of the null pointer exception. At the same time, in order to avoid the occurrence of null pointers, it is best to put "null" or null value before the set value when doing judgment processing.
Explanation: NullPointerException is a null pointer exception. But there is no pointer in Java, how can there be a null pointer exception? In C + +, a pointer to a declaration needs to point to an instance (constructed by the new method), which can be interpreted as an address. In Java, although there are no pointers, but there are references (often referred to as object references, usually direct objects), and references are also to point to an instance object (constructed through the new method), in this sense, the pointers in Java referenced in C + + are no different, but for security purposes, References cannot be manipulated in Java, and pointers can be operated directly in C + +, such as book++.
So the nullpointerexception here is not really a null pointer exception, but essentially the same, because the reference does not point to a specific instance, so when accessing the referenced method, the exception is generated, such as the following code:
String str = "This is a test string!" ";
System.out.println (Str.length ());
This code is fine, but if you change it to the following code:
String str;
System.out.println (str.length);
It will produce nullpointerexception anomalies. So how does this anomaly usually occur? More often than not, the following two cases are found:
1. Call the return value of a method directly to a reference, and then call the method of the reference. In this case, if the value returned is NULL, a NullPointerException exception is bound to occur. For example:
String userName = Request.getparameter ("UserName");
if (Username.length () ==0)
.....
Else
......
If the result of Request.getparameter ("UserName") is null, this exception is generated here.
2. The method that invokes the parameter in the method body. In this case, the NullPointerException exception is also generated if the value passed in when the method is called is null.
To resolve this exception, just check that the exception appears in the first line, then look at the method that called the object, and then check why the object was not assigned successfully.
To avoid this exception, a better solution is to determine whether the object is empty when invoking an object, or, if possible, to add a judgment statement, such as the code above can be written as:
if (str!=null)
System.out.println (Str.length ());
Else
SYSTEM.OUT.PRINTLN (0);
Question 8:
If the GetView () method in Myadapter does not execute, then the adapter.notifydatasetchanged () method should be called (this method is the method in Baseadapter)
Reason:
Setadapter, GetCount () is executed first, and when GetCount () returns 0 o'clock, the GetView () method is not executed, if the thread is opened to download data and then returns its size in GetCount (), At first, since the data was not downloaded, the size returned could be 0, so the GetView () method will not be called, and the interface will not be populated. The GetView () method is called when the adapter is reloaded via the Notifydatasetchanged () method after the download is complete.
Question 9:
Java.lang.ClassNotFoundException:com.example.MainActivity
Individuals are sorted in the following order:
1.
See if the name of the activity is written correctly in Manifest.xml.
2.
In manifest.xml confirm the format of the Android:name attribute in the Activity tab, for example, the name of my activity is HelloWorld, confirm Android:name= ". HelloWorld" (where the points are important).
3.
If you have added an external package, build the Libs directory under the project root, and then place the external package you want to import into this directory and add Jars (Project--"Properties--"--"Java Build Path--" Libraries new plus a SUPPORT-V4 package).
4.
If the problem persists if all of the above are OK, clean works off eclipse-> on the command line restart ADB (adb kill-server adb start-server), open eclipse-> Compile to start.
Question 10 (regarding the use of Viewflow):
When using a popular old version of the network (also known as a modified version that can be used for looping), a flashing image is always present when the picture is sliding.
The workaround is to:
In the Androidmanifest.xml file will be android:targetsdkversion = "17" This sentence is deleted.
Question 11 (about Baidu map):
Java.lang.NoClassDefFoundError:com.baidu.mapapi.BMapManager
Workaround:
First, right-click the project->properties->java Build Path->order and Export, tick in front of the package that needs to be referenced.
Second, Project->clean ...
Question 12:
Caused By:java.lang.ClassCastException:com.fragments.Fragment1 cannot is cast to Android.app.Fragment
The workaround:
(1) Both App.fragment and v4.fragment are available with <fragment> tags.
Only in the use of the time if it is app.fragment there is no special place to inherit activity.
(2) When v4.fragment uses <fragment> tags, it should pay special attention to:
When the activity layout has a <fragment> tag, the activity must inherit
Fragmentactivity, or you will get an error.
So the solution to this error is: Change the mainactivity inherited activity to fragmentactivity.
Question 13:
(Non-Eclipse Error, button click Error 2014-3-17 takes two days to fix a problem):
The Setonitemclicklistener in the GridView does not respond to the problem:
Cause: The button intercepts the click event because it is similar to buttons and ImageButton in each item.
Workaround: This time, the need to change the button or ImageButton to ImageView, the problem has been resolved.
When the problem is solved, it is always exciting (feeling that the previous distress is worth it).
Question 14:
Installation Error:install_failed_insufficient_storage
...
Invalid storage, insufficient storage space, remove a few useless apps can solve the problem.
Question 15:
(in the case of--bitmapfun with the GridView)
Java.lang.classcastexception:android.widget.abslistview$layoutparams cannot is cast to Android.widget.relativelayout$layoutparams
The main reason: Abslistview layoutparams can not be replaced by the. Xml layout file Relativelayout Layoutparams
Question 16:
(in the case of turning on the virtual machine) appears:
This application have requested the Runtime to terminate it on an unusual.
please contact the application's support team for more information.
Possible problem: The amount of RAM that was set when creating the AVD was too large (the device I chose was Nexus 7, with the default RAM of 1024).
Workaround: Change this value to 512 to start the AVD normally.
Question 17 (not error; about Logcat):
Eclipse Logcat A large number of "unexpected value from nativegetenabledtags:0"The workaround:
Enter the following filter string in the Log Message field of the Logcat filter:
^(?!. * (Nativegetenabledtags)). *$
If you still have a lot of information, consider using Logcat's top filter search, search text directly, or Tag:tag. This will allow you to find the information you need to print.
question 18:
The connection to ADB are down, and a severe error has occured.
Workaround: In Eclipse enter DDMS mode, restart the ADB
Question 19:
Ctrl+alt+ direction: This shortcut is used to copy the line code in eclipse, but it hasn't worked in Eclipse recently.
Possible problem: This shortcut is occupied by an app on your computer.
Solution: At that time, the reason is that NetEase cloud music, the voice of a small key is the ctrl+alt+ direction up and down keys, and Eclipse shortcut keys to repeat.
So when the shortcut keys don't work at any time, you should think that the shortcut key might be occupied by an application.
question 20:
Eclipse add Android Library errorReasons for:
I am here project and the library is not under the same drive letter.
So: Under Windows systems, library project must be in the same disk as project.
A habit to develop in the future: when importing project or library, tick copy projects into workspace ... To ensure that all are under the same drive letter.
Question 21:
The full API version (or the API version is not updated) does not appear in the Android SDK manager in Eclipse, Workaround:
1. Add the following information in the Hosts file under the C:\Windows\System32\drivers\etc folder:
#Google主页
203.208.46.146 www.google.com
#这行是为了方便打开Android开发官网 don't seem to be able to open a VPN now.
74.125.113.121 developer.android.com
#更新的内容从以下地址下载
203.208.46.146 dl.google.com
203.208.46.146 dl-ssl.google.com
2. In Eclipse, Android SDK Manager, Tools, Options, others, below, the first one (force ... ) tick the hook.
Question 22:
Layout files in eclips layout file graphical layouts are not displayed:
Conditions <1> (General):
WORKAROUND: Project Right--->android Tools-->fix project Properties, then right-click on Project-->open, open again;
If it is still not available when it is opened again, then restart Eclipse.
Situation <2> (this version of the rendering library is more recent than your version of ADT plug-in. Please update ADT plug-in):
Workaround:
1, update ADT. 2. Change the SDK configuration version in the upper right corner of the ADT version to the lower version 3, manifest.xml folder
Question 23:
The source code of the system is not visible in eclipse: The source attachment does not contain the source for ...When
WORKAROUND: Select the bottom Folder button and select the appropriate path (my choice is: C:\Program Files (x86) \adt-bundle-windows-x86-20130514\sdk\sources\ Android-14\android),
To resolve the problem (also: MyEclipse If you want to view Java source code, then select a src compressed package, as my path is: C:\Program files (x86) \java\jdk1.6.0_10).
Question 24:
(about the use of the ListView)
(1) When the footer added in the ListView are not displayed:
Workaround: Add the footer code before adding it to the Listview.setadaper (adapter) code.
(2) When the footer appears in the ListView when the problem is not centered:
Workaround: Change the properties of the ListView in the layout file to Match_parent.
Question 25:
When importing the Android-support-v7-appcompat.jar package: Jar mismatch! Fix Your dependencies:
My question is: Two packages V4 and V7 are in the project, so it caused a conflict.
The workaround is to remove the V4 package.
Question 26:
Problem: You can't share after packing
The workaround is to:
Can't share:
1. Test not packaged (packaged as APK test)
2, packaging KeyStore and open platform above the inconsistency, resulting in MD5 code inconsistency (in the fill in the MD5 is lowercase, colon to remove)
3, the sharing parameter error (Specify the platform share has the parameter type, each type corresponding has the corresponding parameter, the suggestion user first uses the network picture test, the adjustment then uses the local picture, Onekeyshare does not have the parameter type, will automatically judge)
4, the application is not approved by
5, the package name and open platform above the inconsistency
6. No application for key! in mob.com
My workaround is to:
Download the signature Generation tool on the open platform,:https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list& Verify=1&id=open1419319167&lang=zh_cn
Install the APK project and the signature tool on the phone, enter the sign-up tool to get the signature, and re-fill the application signature with the signature.
Question 27:
Problem: When you change the font size of your phone system, you add the appropriate code, but there will be individual fonts (Huawei Mobile)
The workaround is to:
Change the SP of the corresponding font to DP
Question 28:
Problem: How to run a wireless debug
1. CD to ADB directory
2, command line input adb tcpip 5555
3. Disconnect the USB data and enter the IP address of the ADB connect < device on the computer command line >:5555
4. If you need to disconnect: ADB disconnect < device IP address >
Question 29:
Problem: A packet with the same name with the signature violation is already installed
Cause analysis: Because the previous app was run by Eclipse and the next version was packaged, there was a conflict in the signature.
The workaround is to re-install the package and update it again to avoid this problem.
Question 30:
Problem: Use Eclipse's svn to view the history version garbled problem
Cause Analysis: Coding issues
The workaround is: Windows--preferences--general--workspace--text file Encoding (other UTF-8)
Android Eclipse Common Error Development summary