2016年10月29日 星期六

Cannot find Android NDK Visual Studio (Xamarin)

When you create a mobile project in Visual Studio, you might got he warning message below:

Xamarin.Android for Visual Studio requires Android NDK, which is used to embed .NET assemblies into native libraries. While the NDK is generally not used for developing an Android application, we suggest you to install it. Please set Android NDK path on Tools->Options->Xamarin->Android Settings menu.



To resolve the warning..

Double click the Warning message

The required path is not the root path of the installed NDK, and it should contain the file ndk-stack.exe

If the root path is used, the following error will be shown.

Cannot find ndk-stack.exe in specified NDK path:
ndk-stack.exe

The correct location should be the following

<Your NDK installated location>\ndk-bundle\prebuilt\windows-x86_64\bin

If you installed the ndk via Android Studio, you can find it from the SDK folder.

If you do not have the Android Studio, you can download it from the official website:

https://developer.android.com/ndk/downloads/index.html

2014年9月5日 星期五

Use your red mi for development

Most of you know that miui offers low price smartphone, it is good to have one for the development.

To enable debug mode on mi or Android 4.2+, you need to tap the "Android Version" 7 times to start the debug mode.



New option for development was shown.

2014年5月6日 星期二

[Resolved] URL not found during the installation of package using SDK Manager

Access is denied when installation package.

Solution
Try to run as administrator and install the package again.


[Resolved] Failed to rename directory when build the android project

Tried to build the android project but returns the following error.

Solution
It is due to not enough permission, try to close the android studio and run as administrator again.

2014年1月12日 星期日

[Resolved] Android Studio: The System cannot find the file specified.

When trying to run the application in debug mode / Generate signed apk in Android Studio, system returns Error Message "Error: X:\XXX\XXX.apk The System cannot find the file specified."
After that another message "Error: Unable to open Y:\YYY\YYY.apk as a zip archive"




To resolve, click the icon in the menu in Android Studio

Run the application again, success!

2014年1月9日 星期四

Test GPS location with Android Studio

This article shows you how to set the GPS location in your Android Studio.

 1. Menu ->Tools -> Android ->Monitor (DDMS included)


2. Input the Longitude and Latitude in Location Control

2013年1月17日 星期四

[Resolved] The connection to adb is down, and a severe error has occured.

System returns the following error when running an android project in Eclipse.



[2013-01-17 22:34:06 - XXX] The connection to adb is down, and a severe error has occured.
[2013-01-17 22:34:06 - XXX]You must restart adb and Eclipse.
[2013-01-17 22:34:06 - XXX] Please ensure that adb is correctly located at 'C:\android-sdks\platform-tools\adb.exe' and can be executed.



Solution:
1. Restart eclipse
2. In command prompt, go to the Android sdk platform-tools directory.
3. type command: adb kill-server
4. and then type command: adb start-server


Meanwhile, the following logs will be shown in eclipse.


2013年1月6日 星期日

[Resolved] You must have AdActivity declared in AndroidManifest.xml with configChanges

You must have AdActivity declared in AndroidManifest.xml with configChanges.



Solution
Add the following Activity in AndroidManifest.xml file.



<application ...>

<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

</application>

2012年12月27日 星期四

Local datetime in SQLite




This article shows how to get the local date time from SQLite


When we run the following SQL, it returns the UTC time..

select datetime('now');

2012-12-26 16:01:07




To return the local time, you can add the the parameter 'localtime' 

select datetime('now', 'localtime');

2012-12-27 00:01:07

2012年12月18日 星期二

[How-to] Get the year-month-day (yyyy-mm-dd) from a date field in SQLite

SQLite is the database for the Android Application.


The following SQL is an example of getting date by SQL statement.

select _id, strftime('%Y-%m-%d', create_date) c_date from TABLE1

Returned result:


Another SQL example shows how to get counts of records by date

select strftime('%Y-%m-%d', create_date), count(strftime('%Y-%m-%d', create_date) ) from TABLE1 group by strftime('%Y-%m-%d', create_date)



More reference for the date field in SQLite can be found in the official website
http://www.sqlite.org/lang_datefunc.html

2012年12月11日 星期二

[Resolved] Android: WebView Web Page not available

Today I'm trying to create a WebView in Android, it shows a Web page not available after running the app in the emulator.




       protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
             
              WebView wv = (WebView) findViewById(R.id.webView1);             
              wv.loadUrl("https://www.google.com");
             
                }

Solution 

1. Make sure the permission is granted
<uses-permission android:name="android.permission.INTERNET"></uses-permission>


2. Make sure the following bold content in your code
       protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
             
              WebView wv = (WebView) findViewById(R.id.webView1);
              wv.setWebViewClient(new WebViewClient(){});
             
              wv.loadUrl("https://www.google.com");
             
                }

2012年11月25日 星期日

Andriod Permission: Connect to Internet



The following permission should be grant for the internet connection from Android Application.

<manifest xmlns:android="http://schemas.android.com/apk/res/android" ... />
    ...
    <uses-permission android:name="android.permission.INTERNET" />
</manifest>