Android mail list: android-developers@googlegroups.com View topics in mail list: http://groups.google.com/group/android-developers/topics Popular Forums: - Android Development Community | Android Tutorials http://www.anddev.org/ - xda-developers http://forum.xda-developers.com/ - Development
- [Issue] Application crush when return from predefined interface
[Solution 1] You may forgot to call the method of predefined super class i.e.: In your Activity, if you override onDestroy as following: class YourActivity extends Activity { protected void onDestroy() { } } when the activity is destroyed, application will crash, in order to resolve this issue, you must modify the code snip to: class YourActivity extends Activity { protected void onDestroy() { super.onDestroy(); //Call the same method of super class } } - [Issue] Explain view's attributes
android:gravity: Define which direction to align control's contents. - [Issue] How to get and Set system property
[Solution] Use methods System.getProperty(xxx) and System.setProperty(xxx), following properties can be got and set: java.vendor.url java.class.path user.home java.class.version os.version java.vendor user.dir user.timezone path.separator os.name os.arch line.separator file.separator user.name java.version java.home - [Issue] How to get popular directories and their stat
[Sulotion] Call method android.os.Environment, following directories can be received: a) root directory b) external storage directory c) data directory d) download cache directory e) external storage state, Note: USB mass storage path is /sdcard - [Issue] How to access resource in package in Acrivity
- Get resource value getResources().getString(resID); //resID looks like R.string.str_id - Get resource id from name getResources().getIdentifier("name", "string", getPackageName()); getResources().getIdentifier("name", "drawable", getPackageName()); - [Issue] How to get and set environment variables
[Solution] To get the value of the specified environment variables, just use System.getenv(xxx); But you can't set environment variable in Java code directly, you need to use jni to call C function 'setenv'. - [Issue] How to know byte order of device
[Solution] Call method ByteOrder.nativeOrder(); - [Issue] How to read files in the directories res/raw
[Sulotion] Resources res = getResources(); InputStream is = res.openRawResource(R.raw.xxx); - [Issue] How to display horizontal bar in widget
[Solution] Use a view which background is filled with the specified color. <TableLayout xxxxxx> <TableRow xxxxxx> ...... </TableRow> ...... <View android:layout_height="2dip" android:background="#FF909090" /> ...... </TableLayout>
Comments: 1) A control View with the specified background is shown as a bar 2) The View must be declared within TableLayout 3) If your want to implement the horizontal bar with left/right edges fading just like ListView's divider, you only need to set android:background to "?android:attr/listDivider"
- [Issue] How to change contents of TextView
- Set text view to be editable TextView textView = findViewById(xxx); textView.setText(textView.getText(), TextView.BufferType.EDITABLE); - Change contents textView.setText(xxx); textView.append(xxx); - [Issue] Customize View
- Define customized view class as following package com.test.customized; import xxxxxx; class CustomizedTextView { private static String HEADER = "(Warning)"; private static String RETURN = "/n";
public TextView(Context context) { super(context); }
public TextView(Context context, AttributeSet attrs) { super(context, attrs); }
public TextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); }
public void append(CharSequence text, int start, int end) { super.append(HEADER, 0, HEADERS.length()); super.append(text, start, end); super.append(RETURN, 0, RETURN.length()); } }
- Use the customized view as following <?xml version="1.0" encoding="utf-8"?> <com.test.customized.CustomizedTextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="Hello, Android"/> - [Issue] How to use multiple Activity
[Solution] Please refer to: http://www.apkcn.com/android-80860-1-1.html http://blog.csdn.net/Class_Raito/archive/2008/11/27/3390737.aspx - [Issue] How to launch activity
[Solution] Launch application 1) From shell usage: am [start|instrument] am start [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>] [-c <CATEGORY> [-c <CATEGORY>] ...] [-e <EXTRA_KEY> <EXTRA_VALUE> [-e <EXTRA_KEY> <EXTRA_VALUE> ...] [-n <COMPONENT>] [-D] [<URI>] am instrument [-e <ARG_NAME> <ARG_VALUE>] [-p <PROF_FILE>] [-w] <COMPONENT> For example, launch an application whose manifest are: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="net.xiashou.android"> <application> <activity> <intent-filter> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> Command is: #am start -n net.xiashou.android/net.xiashou.android.HelloAndroid
Other usage: a) Launch browser to open an URI: #am start -a android.intent.action.VIEW -d http://www.xiashou.net b) Call out: #am start -a android.intent.action.CALL -d tel:10086 c) Launch google map to locate TianJing: #am start -a android.intent.action.VIEW geo:0,0?q=tianjin
2) From on activate: Use Intent. For example, launch an activate whose manifest is: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="koushikdutta.superuser" android:versionCode="1" android:versionName="1.0.0">
<permission android:name="android.permission.ACCESS_SUPERUSER" android:label="@string/superuser_permissions_name" android:description="@string/superuser_permissions_description" android:protectionLevel="dangerous" />
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true"> <activity android:name=".SuperuserActivity" android:label="Superuser Whitelist"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".SuperuserRequestActivity" android:label="Superuser" android:permission="android.permission.ACCESS_SUPERUSER"> <intent-filter> <action android:name="android.intent.action.superuser" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> </application> </manifest>
Launch code is: Intent intent = new Intent("android.intent.action.superuser"); startActivityForResult(intent, SUPERUSER_REQUEST); - [Issue] How to close current Activity and remove it from Activity history stack when you switch to other Activity
[Solution] Call "finish()" in current Activity's methods. - [Issue] How to use class "Cursor"
[Solution] Cursor stores the results of database query, such as ContentResolver.query(xxxxx), Cursor contains M(Rows) x N (Columns) eluments, each column has its name and value, we can get them by calling getColumnName() and getString/getInt()/getLong()/getShort()..... etc respectively. - [Issue] How to send Http request
[Solution] Use folloing code: (refer to http://blog.atrexis.com/index.cfm/2008/6/20/Sending-HTTP-requests-in-Android http://dotphone.org/redirect.php?tid=33&goto=lastpost http://dev.shufou.com/?p=28 )
URL url = new URL("www.baidu.com"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); conn.setConnectTimeout(10000); conn.setRequestMethod(HttpURLConnection.GET); conn.setRequestProperty("accept", "*/*"); String location = conn.getRequestProperty("location"); int resCode = conn.getResponseCode(); InputStream stream = conn.getInputStream(); - [Issue] Java Network exception
- When establish network connection using socket, SocketException is throwed, and exception readable string is: "java.net.SocketException:Connection reset". Solution: add android.permission.INTERNET to application manifest - Android java.net.SocketException: The connection was reset Reason: The time out value is too long, try 10 seconds. - [Issue] How to communicate in between threads
[Solution] Use classes Handler & Runnable & Thread 1) Handler: Provide a type of message process policy, each Handler instance is bound to a single thread and that thread's message queue. A Handler instance just like HWnd of Microsoft Windows, but different from Windows, both Message and the specified object -- Runnable can be send to destination thread's message queue. If Message will be send, Handler must be extended to overload member function handleMessage(Message); If Runnable will be send, Runnable must be extended to overload member function run(). 2) Runnable: Just declare a uniform interface. 3) Thread: A Thread is a unit of concurrent execution. Througn Thread, we can avoid performing long-running operations directly in the UI thread — the main thread of an application where the UI is run — or your application may be blocked and become unresponsive 4) Sample: public class MyActivity extends Activity { private Handler m_handler; private TextView m_textView;
class MyHandler extends Handler { public void handleMessage() { //Flash UI m_textView.setText("xxxx"); } }
class MyThread extends Thread { public void run() { Message msg = handler.obtainMessage(); msg.what = xxx; msg.obj = xxx; msg.sentToTarget(); } }
public void onDestroy() { super.onDestroy(); m_handler = null; m_textView = null; }
public void onCreate(xxx) { ...... m_textView.findViewById(...); m_handler = new MyHandler(); MyThread thread = new MyThread(); thread.start(); } } - [Issue] How to uninstall package programmatically
[Sulotion] Uri uri = Uri.fromParts("package", strPackageName, null); //strPackageName is package name which will be uninstalled Intent it = new Intent(Intent.ACTION_DELETE, uri); startActivity(it);
Notes: must request to use permission "android.permission.DELETE_PACKAGES"" - [Issue] How to terminate process
[Solution] Use following statement to kill current process: android.os.Process.killProcess(android.os.Process.myPid()); - [Issue] How to execute P/V operation (mutex)
[Soluction] Use class ConditionVariable or Semaphore - Request to use necessary permission
If necessary permission is not requested in AndroidManifest.xml, when application is running, it will abort with messages "Source not found" in DEBUG mode, or abort with messages "The application xxx has stopped unexpectedly. Please try again" in RELEASE mode. - [Issue] How to Get Android package information in Activity
The Android package information contains all contents defined in AndroidManifest.xml, Such as versionName, versionCode, activities, services, providers, services, signatures etc. PackageInfo pkgInfo = getPackageManager().getPackageInfo(getPackageName(), flags);//flags is different for different package information i.e. get versionName PackageInfo pkgInfo = getPackageManager().getPackageInfo(getPackageName(), 0); String verName = pkgInfo.versionName;
Please refer to following online document to get more details http://code.google.com/intl/en-CN/android/reference/android/content/pm/PackageManager.html http://code.google.com/intl/en-CN/android/reference/android/content/pm/PackageInfo.html - [Issue] How to define language(International) and screen orientation(Portrait/Landscape) dependent resource
[Solution] Please refer to http://code.google.com/intl/zh-CN/android/devel/resources-i18n.html - [Issue] Activity gets restarted once screen orientation changed
[Sulution] Addandroid:configChanges="keyboardHidden|orientation" to your manifest file, if you don't want Activity to be restarted once other configurations are changed, juse append other proper items to android:configChanges, more details about android:configChanges, please refer to http://developer.android.com/intl/zh-CN/reference/android/R.attr.html#configChanges, then search keywords "configChanges" - [Issue] What is deployed after application is installed
[Solution] After application is installed, 1) .apk will be copied to /data/app 2) An empty directory with the same name as package name of .apk will be created in /data/data 3) /data/system/packages.xml will be updated (More details, please refer to Android Package Installation http://blog.csdn.net/loughsky/archive/2008/11/14/3298868.aspx ) - Implment schedule task
Use AlarmManager. Sample: mgr=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE); Intent i=new Intent(context, OnAlarmReceiver.class); PendingIntent pi=PendingIntent.getBroadcast(context, 0, i, 0); //or call getService/getActivity for Service/Activity intent
mgr.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), PERIOD, pi); In this example, I am using setRepeating(). If you want a one-shot alarm, you would just use set(). Be sure to give the time for the alarm to start in the same time base as you use in the initial parameter to set(). In my example above, I am using AlarmManager.ELAPSED_REALTIME_WAKEUP, so my time base is SystemClock.elapsedRealtime(). - Get packages information
Use PackageManager. Use PackageManager.getPackageManager to get package manager instance. The installation file name is PackageManager.getPackageManager.applicationInfo.sourceDir
- List all media files
i.e.: Uri[] uriMedia = { MediaStore.Images.Media.EXTERNAL_CONTENT_URI, MediaStore.Images.Media.INTERNAL_CONTENT_URI, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, MediaStore.Audio.Media.INTERNAL_CONTENT_URI, MediaStore.Video.Media.EXTERNAL_CONTENT_URI, MediaStore.Video.Media.INTERNAL_CONTENT_URI }; for (int i = 0; i < uriMedia.length; i++) { Cursor cur = resolver.query (uriMedia[i], null, null, null, null); while (cur.moveToNext()) { String strFileName = cur.getString(cur.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA)); //All supported cursor columns are MediaStore.MediaColumns, MediaStore.MediaColumns, MediaStore.Audio.AudioColumns, MediaStore.Video.ViceoColumns, MediaStore.Images.ImagesColumns } }
Sample: http://code.google.com/p/i-jetty/source/browse/trunk/modules/i-jetty/src/org/mortbay/ijetty/console/MediaBrowserServlet.java?r=247 - Add scroll bar
Add ScrollView out of target view, i.e <ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" > <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"/> <TableLayout android:id="@+id/headertable" android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="1" android:collapseColumns="2"/> <TextViewandroid:layout_width="fill_parent" android:layout_height="wrap_content"> </ScrollView>
Issue: if scroll bar overwrap contents within the scrollview, you can add android:scrollbarStype="insideInset" to ScrollView, i.e. <ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollbarStype="insideInset" > or set dynamic in source code as: findViewById(R.id.scroll_view_id).setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET); - Can't get phone number use TelephonyManger
- Verify proper permissions is declared in manifest file
- Check whether getLine1Number() returns null ?
- Verify the setting application (go to Settings > About phone > Status > (My) phone number). You should be able to see your phone number.
- In cases where you have the radio switched off you cannot read the
phone number from your SIM card or the SIM card is not available at all, for example, the phone network is switch to Airplane mode. - ...
- Get subscriber id
- Verify proper permissions is declared in manifest file
- The phone network is available.
- You can access the website and input the IMSI to verify:
https://www.numberingplans.com/?page=analysis&sub=imsinr - ...
- How to know which table is created in datebase, and what columns the table contains.
i.e. Get to know table details in /data/data/com.google.providers.telephony/databases/mmssms.db. Solution: 1, adb pull /data/data/com.google.providers.telephony/databases/mmssms.db . 2, strings mmssms.db > tmp.txt 3, vi tmp.txt, and search 'CREATE TABLE' - Backward Compatibility for Application
http://developer.android.com/resources/articles/backward-compatibility.html - setvisibility
view.setvisibility(View.INVISIBLE); view.setvisibility(View.VISIBLE); - Relayout UI
- Change Layout Attributes
RelativeLayout layout = (RelativeLayout) findViewById(R.id.xxxx); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)layout.gerLayoutParams(); params.addRules(xxx, xxx); layout.addLayoutParams(params); layout.requestLayout(); - Dynamic Add/Remove SubViews
Layout layout = (Layout)findViewById(xxxx); layout.removeAllViews(); or layout.removeViewAt(xxx); or layout.removeView(xxx); .... layout.addView(xxx); or layout.addViewAt(xxx);
================================ or View view = fineViewById(xxxx); view.setVisible(View.GONE);
The layout will relayout and align automatically. - Change button's image
call setCompondDrawablesWithIntrinsicBounds - The title of TableHost can't be shown (it background's color is the same as foreground's)
It may caused by sdb version. that is you build application with higher Android SDK, but in AndroidManifest file, you specified lower SDK version using <uses-sdk android:minSdkVersion="xxx"/> - Launch an Activity from background to foreground
you can't switch your activity from background to foreground in Activity, you must do this in Service.
Intent intent = new Intent(parentIntnet, target.class); intent.setAction(xxxx); intent.addCategory(xxx); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED) startActivity(intent); - Activity is restarted automatically
In following situations, Activity will be restarted automatically. - Memory is low
Override onLowMemory method to see if it is called before Activity is restarted. If this method is called, your application uses too much memory.
In such situation, you must optimize your application to decrease low memory usage. - Configuration is changed
- in AndroidManifest.xml, add android:configChanges attributes in Activity elements, and set it to all available value (About available value, please refer to http://developer.android.com/guide/topics/manifest/activity-element.html ), ie. android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale"
- Override method onConfigurationChanged(Configuration newConfig) to see if it is called. If it is called, it is configuration changing to cause your Activity restarted.
In such situlation, you can set proper android:configChanges (First, add all available value to android:configChanges, then decrease it from android:configChanges one by one) to prevent your Activity to be restarted. - How to use Android internal package
such as com.android.internal.* [Solution] Get source code of internal package and depended packages, then add the source code to you project. [ie] To use internal class ITelephony - Prepare ITelephony.aidl
Download iTelephony.aidl from http://code.google.com/p/mylockforandroid/source/browse/trunk/phone/src/com/android/internal/telephony/ITelephony.aidl?r=317 then add that file to src/com/android/internal/telephony/ of your project - Write code
import com.android.internal.telephony.ITelephony; ...... ITelephony telephonyService = ITelephony.Stub.asInterface(ServiceManager.getService(Context.TELEPHONE_SERVICE);
//Call method of ITelephony telephonyService.endCall(); - xxx
- When to start an activity via method startActivityForResult, don't set flag FLAG_ACTIVITY_NEW_TASK
- ...
- Debug
- adb
- Open shell of mobile device from host
Run "adb shell" on terminal on your host computer which is connected to your mobile device. - Get system log
Run "adb logcat" on terminal on your host computer which is connected to your mobile device, then system logs generated on mobile device sill display on the terminal. - ,,,
- Debug on device
- Set build mode to "Debug" on Eclipse before build - Select the checkbox "Settings->Applications->Unknown sources" on mobile device - Select the checkbox "Settings->Applications->Development->USB debugging" on mobile device - Set USB Mode
- Drag status bar to open prompt - Press USB Connection to select mode - [Issue] How to list all GUI objects
[Solution] Make sure you have a dev device/emulator (if you see "1", you're out of luck): $ adb shell getprop ro.secure 0
Start the server: $ adb shell service call window 1 i32 4939
You should see the following result (the "1" means the server is running): Result: Parcel(00000000 00000001 '........')
Install the port forwarding: $ adb forward tcp:4939 tcp:4939
Connect to the server: $ telnet localhost 4939
Now, you can use one of two commands (type enter after each command):
- LIST will show the list of windows: LIST 43514758 com.android.launcher/com.android.launcher.Launcher 4359e4d0 TrackingView 435b00a0 StatusBarExpanded 43463710 StatusBar 43484c58 Keyguard DONE.
- DUMP will show the views and their properties for a given window. For instance, DUMP 43514758 will show the views contained in the window com.android.launcher/com.android.launcher.Launcher. You can also use DUMP -1 or DUMP ffffffff to dump the foreground window. I recommend that version. The dump may take a while go be generated and it looks like this:
DUMP -1 com.android.internal.policy.impl.KeyguardViewManager$KeyguardViewHost@434d8220 getDescendantFocusability()=24,FOCUS_BEFORE_DESCENDANTS getPersistentDrawingCache()=9,SCROLLING isAlwaysDrawnWithCacheEnabled()=4,true isAnimationCacheEnabled()=4,true isChildrenDrawnWithCacheEnabled()=5,false mMinWidth=1,0 mMinHeight=1,0 mMeasuredWidth=3,320 mMeasuredHeight=3,455 mPaddingBottom=1,0 mPaddingLeft=1,0 mPaddingRight=1,0 mPaddingTop=1,0 mLeft=1,0 mID=5,NO_ID mPrivateFlags=4,3248 mRight=3,320 mScrollX=1,0 mScrollY=1,0 mBottom=3,455 mTop=1,0 mUserPaddingBottom=1,0 mUserPaddingRight=1,0 mViewFlags=9,402653312 getBaseline()=2,-1 getHeight()=3,455 layout_height=11,FILL_PARENT layout_width=11,FILL_PARENT getTag()=4,null getVisibility()=7,VISIBLE getWidth()=3,320 hasFocus()=4,true isClickable()=5,false isDrawingCacheEnabled()=5,false isEnabled()=4,true isFocusable()=5,false isFocusableInTouchMode()=5,false isFocused()=5,false isHapticFeedbackEnabled()=4,true isInTouchMode()=4,true isSelected()=5,false isSoundEffectsEnabled()=4,true willNotCacheDrawing()=5,false willNotDraw()=4,true ... DONE.
The format is simple. Each View is defined on a line of text which ends with /n. The indent at the beginning of the line indicates the depth of the child in the hierarchy. For instance, no indent == root, 1 space == child of the root, 2 spaces == child of a child of the root, etc.
className@id followed by a list of properties. A property has the following format: name=X,data where X is the number of characters in the data. - Useful debug tools
- am
Log into the shell of mobile device, then type the following command on shell: - Run application: $am start -n <package-name>/<package-name>.<class-name> - Enter debug mode when run app, just add -D before -n, i.e. $am start -D -n com.mydomain.test/com.mydomain.test.Main - Trigger broadcast am start -a <broadcast-action> i.e.: am start -a android.intent.action.MEDIA_BUTTON - ...
- [Issue] When you compile your project, following error message is shown
invalid resource directory name The project cannot be built until build path errors are resolved [Solution] Invalid file may exist under directory 'res/' and/or its sub-directory. For example, a .txt file exists in the directory res/. Just find the invalid file then remove it. - ...
- SDKs Issue
- [Issue] SDK 1.5 build error
[2009-07-01 15:13:50 - HelloWorld] no classfiles specified [2009-07-01 15:13:50 - HelloWorld] Conversion to Dalvik format failed with error 1 [Solution]: Step 1:Right click->project -> properties -> android -> project build target to set target to SDK 1.5 Step 2: Click Project, then press F5 to reload project files. - [Issue] SDK 2.1 no available targets
[Solution] On Eclipse, click Window -> Android SDK and AVD Manager -> Installed Packages -> Update All, (Or clickWindow -> Android SDK and AVD Manager -> Available Packages to install necessory sdk first.)
- [Issue] Build error: Project XXX is missing required source folder: 'gen'。
[Solution] Remove R.java, then flash project, and build again. - [Issue] Create AVD (Android Virtual Devices) for Eclipse
[Solution]click Window -> Android SDK and AVD Manager -> Ivirtual Devices, - ......
- NDK Issue
- [Issue] Install NDK error
When install NDK with command: $ ./build/host-setup.sh Following error message display: Detecting host toolchain. ./host-setup.sh: 57: force_32bit_binaries: not found ./host-setup.sh: 58: setup_toolchain: not found ./host-setup.sh: 60: cannot create : Directory nonexistent Can't create directory for host config file: out/host [Solution] $ cd /bin $ rm sh $ ln -s bash sh or change the first line of file ./build/host-setup.sh to "#!/bin/bash" - C/C++ toolchain
- Link Type
- Dynamic link
LDALGS += -nostdlib -Wl,-dynamic-linker,/system/bin/linker / <ANDROID_NKD_PATH>/build/prebuilt/linux-x86/arm-eabi-4.2.1/arm-eabi/lib/ldscripts/armelf.x / <ANDROID_NKD_PATH>/build/platforms/android-1.5/arch-arm/usr/lib/crtbegin_dynamic.o / <ANDROID_NKD_PATH>/build/platforms/android-1.5/arch-arm/usr/lib/crtend_android.o
LIBS += -lc -ldl
- Static link
LDALGS += -nostdlib -static / <ANDROID_NKD_PATH>/build/prebuilt/linux-x86/arm-eabi-4.2.1/arm-eabi/lib/ldscripts/armelf.x / <ANDROID_NKD_PATH>/build/platforms/android-1.5/arch-arm/usr/lib/crtbegin_dynamic.o / <ANDROID_NKD_PATH>/build/platforms/android-1.5/arch-arm/usr/lib/crtend_android.o
LIBS += -lc -lgcc
- Build issue and solution
- [Issue] crt0.o: No such file: No such file or directory collect2: ld returned 1 exit status
[Solution] add building flag "-nostdlib"
- [Issue] warning: cannot find entry symbol _start; defaulting to....
[Solution] link crtbegin_dynamic.o or crtbegin_static.o; or ignore this warning. since if you add crtbegin_dynamic.o, the application may be dead-locked. - [Issue] when run binary file,error message "binary_file: not found
[Solution] add ldflags "-Wl,-dynamic-linker,/system/bin/linker" during building - [Issue] When main function returns (after executing 'return 0'), segmentation fault signal is triggered
[Solution 1st] add "exit(0);" just before "return 0;" in source code. [Solution 2nd] add ldflags "<ANDROID_NKD_PATH>/build/prebuilt/linux-x86/arm-eabi-4.2.1/arm-eabi/lib/ldscripts/armelf.x <ANDROID_NKD_PATH>/build/platforms/android-1.5/arch-arm/usr/lib/crtbegin_dynamic.o <ANDROID_NKD_PATH>/build/platforms/android-1.5/arch-arm/usr/lib/crtend_android.o" during building - ....
- ....
- Enulator
- [Issue] How to switch screen orientation
[Solution] Ctrl + F11 - ...
- Android Phone Using
- [Issue] How to crack G1
[Solution] Please refer to http://www.juluren.com/bbs/thread-3634-1-1.html - [Issue] How to flash firmware
[Solution] G1 flash (rest) - Manual flash
http://www.5dpda.com/bbs/viewthread.php?tid=20058 - Factory reset
http://gphone.tgbus.com/jc/syjc/200811/167589.shtml - Download update package
http://android-dls.com/wiki/index.php?title=OTA_Updates http://forum.xda-developers.com/showthread.php?t=668090 - If you encounter following issue during flashing
E: No signature (413 files) E: Verification failed Installation aborted Please reset bootloader first, then flash frameware. - How To Reset Bootloader
a) Download DREAIMG-RC29.zip (you can download from http://android-dls.com/files/upload/DREAIMG.nbh) b) Format sdcard to FAT32 (must be FAT32) c) Unzip DREAIMG-RC29.zip, and copy DreaIMG.ngh to sdcard (case sensitive) d) Power off, and insert sdcard e) Press Camera + Power Off key f) Press Power Off key according to prompts (If prompts are not shown, but instead, "Serial 0" is shown directly, that may be the sdcard is not in FAT32 format) g) Press Action key when flash completed h) Press Call + Menu + Power Off key to reboot device - If You Can't Register Google Account
1) Download AndroidMod.zip 2) Flash update -Restore Original RC29 Boot Image.zip to the device 3) Register again - How to compile source code
http://xy0811.spaces.live.com/Blog/cns!F8AECD2A067A6B17!1457.entry - [Issue] How to get root privilege
1) Telnet as root, and Add busybox: Gain Root: http://android-dls.com/wiki/index.php?title=Rooting_Android Keep Root: http://android-dls.com/wiki/index.php?title=Keeping_Root Gain Root on Android 1.5 (I used JesusFreke 1,51 as lastest build): http://theandroidsite.com/2009/05/14/how-to-root-your-g1-and-install-android-15-cupcake/ Add Busybox: http://android-dls.com/wiki/index.php?title=Latest_version_of_busybox Complete toturial: http://www.webnetta.com/2009/01/02/t-mobile-g1-rc30-to-jfv13/ Comment: To execute telnetd, you must install Shell.apk and execute telnetd in command line on the device, but can't run it via "adb shell".
2) Source code: http://www.koushikdutta.com/2008/11/fixing-su-security-hole-on-modified.html Flash modified kernal: http://forum.xda-developers.com/showthread.php?t=443041
- [Issue] While mobile device is connected to host pc, the popup windows can't get response on host pc
[Solution] just kill process f-spot.exe on host pc - [Issue] How to login into mobile device with telnet
[Solution] 1) Reboot device 2) Open terminal 3) run 'cd /; cd system; cd bin; telnet' on device 4) telnet <device-ip> on remove computer. - ...
- Build with Eclipse
- [Issue] When build application,following error message display
ERROR: Application does not specify a android.test.InstrumentationTestRunner instrumentation or does not declare uses-library android.test.runner [Solution 1] - Add following code to AndroidManifest. <instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="your.package" android:label="your tests label" /> <uses-library android:name="android.test.runner" />
- Right click project on Project Explorer Panel on Eclipse, then click "Run" > "Run Configurations...", then select "android.test.InstrumentationTestRunner" in Instrumentation TestRunner. [Solution 2] When to run application via Eclipse, don't select "xxx JUnit Test" on "Run As" dialog. Or right click project on Project Explorer Panel on Eclipse, then create a new Run/Debug configure file under the categories except "xxx JUint Test" - ...
- Sign package
- keytool error
[Issue] c:/3960/glassfish/domains/domain1/config>keytool -genkey -keyalg RSA -keystore a mkeystore.jks -validity 365 -alias "fam8" -dname "amqa-x2100-01.red.iplanet.com, ou=identity,o=sun.com,L=santa clara, ST=CA, C=US" Enter keystore password: Re-enter new password: keytool error: java.io.IOException: Incorrect AVA format
[Solution] dname format is wrong, it shold be Should be "cn=amqa-x2100-01.red.iplanet.co..........." - ...
- Sign Application
- Manual of keytool
http://java.sun.com/j2se/1.3/docs/tooldocs/win32/keytool.html - How to access Android resource
with android.R.xxx, i.e. android.R.string.xxx, android.R.drawable.xxx - Reengineer(反编译) APK file
- Download apktool-1.2.0.tar.bz2 and apktool-install-linux-2.2_r01-1.tar.bz2 from http://code.google.com/p/android-apktool/
- Uncompress them under Linux,
- Execute ./apktool d <apk-file> [dir] to reengineer
- App stores
- SK Telecom store (TStore)
http://www.tstore.co.kr - ...
| | |