顯示具有 Resolved 標籤的文章。 顯示所有文章
顯示具有 Resolved 標籤的文章。 顯示所有文章

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!

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月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日 星期日

[RESOLVED] E/ERR(1183): org.apache.http.conn.HttpHostConnectException: Connection to http://localhost refused

Today I am trying to write an android program to retrieve an XML data from localhost server. When running the program, the following error occurs:

E/ERR(1183): org.apache.http.conn.HttpHostConnectException: Connection to http://localhost refused




              String url = "http://localhost:100/test.xml";

              try {
                     DefaultHttpClient httpClient = new DefaultHttpClient();
                     HttpPost httpPost = new HttpPost(url);

                     HttpResponse httpResponse = httpClient.execute(httpPost);
              } catch (ClientProtocolException e1) {
                     // TODO Auto-generated catch block
                     e1.printStackTrace();
              } catch (IOException e1) {
                     // TODO Auto-generated catch block
                     e1.printStackTrace();
              }
             
 


Solution:
The Android emulator could not recognize the localhost and results in connection refused.
To resolve, we can change the localhost to the ip address 10.0.2.2 and try again, problem resolved.

e.g. String url = "http://10.0.2.2:100/test.xml";
 



2012年11月15日 星期四

The project was not built due to "Could not delete '/XXXX'."

Sometimes when building the java application, the following error occurs:

The project was not built due to "Could not delete '/XXXX'.". Fix the problem, then try refreshing this project and building it since it may be inconsistent



Solution:
1. Click: Project --> Clean
 


2. After rebuild, the error is gone!

2012年11月11日 星期日

[RESOLVED] INSTALL_FAILED_MISSING_SHARED_LIBRARY when using Google API

Today I'm trying to write Google Maps Application on Android. When running the application, the following errors occur:



[2012-11-11 20:20:45 - XXX] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2012-11-11 20:20:45 - XXX] Please check logcat output for more details.
[2012-11-11 20:20:45 - XXX] Launch canceled!


Resolution:
It is because Google Maps is not installed on the device / emulator.

1. Choose the Android Version and install "Google APIs by Google Inc."

2. In project properties, choose Google APIs as the Project Build Target.

3. Build again and success!


2012年11月4日 星期日

Unable to resolve target 'android-14'

When importing an old source code in eclipse today, the following error occurs:
Unable to resolve target 'android-14'


It is because android-14 does not installed in the machine.
You can change the android version via the project properties. For example, the API version for Android 4.0.3 is 15.


Then open the AndroidManifest.xml to change the sdk version to 15.
<uses-sdk android:minSdkVersion="15" />


2012年6月18日 星期一

[SOLVED] A Java Runtime Environment (JRE) or Java Development Toolkit (JDK) must be available in order to run Eclipse


A Java Runtime Environment (JRE) or Java Development Toolkit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following


Solution:

Java must be installed in your Windows in order to run eclipse.
http://java.com/en/download/index.jsp

After installed Java, set the JAVA PATH in System Variable.