2012年3月28日 星期三

【Android】Development Note

General:

  1. AdMob 4.3.1 need to use bigger than Android 3.2 SDK
  2. android:adjustViewBounds="true" auto scale to all parent
  3. SDK can not find adb.exe,we sould add system enviroment path link to D:\Program Files\Android\android-sdk\platform-tools(platform-tools default not exist)first,and execute SDK Manager for downloading Platform-tools

R17:

  1. jar file need to put into a libs folder in project

Android 3.1出现 android.os.NetworkOnMainThreadException异常 

解决办法:

在onCreate方法中添加如下代码:

  1: public void onCreate() {  
  2:      StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()     
  3:             .detectDiskReads()     
  4:             .detectDiskWrites()     
  5:             .detectNetwork()   // or .detectAll() for all detectable problems     
  6:             .penaltyLog()     
  7:             .build());     
  8:      StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()     
  9:             .detectLeakedSqlLiteObjects()     
 10:             .detectLeakedClosableObjects()     
 11:             .penaltyLog()     
 12:             .penaltyDeath()     
 13:             .build());  
 14: } 

沒有留言:

張貼留言