Sunday, July 10, 2011
Error conversion to Dalvik format failed with error 1
UPDATE: This issue was fixed in SDK Tools 17. If you have SDK Tools 17+ the solution here will not help you.
There is a bug in the latest Android SDK Tools (revisions 12, 13, 14, 15 & 16) which cause the following error:
Error conversion to Dalvik format failed with error 1
when you try to export your Android application & got Proguard enabled.
Google will probably fix it within few days, until then DO NOT UPDATE to Android SDK Tools revision 12. Someone already opened a bug on this issue.
Solution 1 - Restore SDK Tools v11 (ugly but it works):
If you did upgrade, the instructions how to install Android SDK Tools v11 on top can be found here. I did something similar which I think is safer & easy to undo:
1. Download Android SDK Tools v11 installer from here: http://dl.google.com/android/installer_r11-windows.exe
2. Rename the existing Android SDK\Tools folder to Tools-v12
3. Open the installer using 7zip, go to folder $_OUTDIR, and copy the folder 'Tools' the the position under Android SDK folder.
Solution 2 - Upgrade to Proguard 4.7 (needs to be reapplied after every SDK Tools upgrade):
Manually update Proguard to version 4.7. You'll have to do it again after each update of the SDK Tools.
1. Download Proguard 4.7 (zip): http://sourceforge.net/projects/proguard/files/proguard/4.7/
2. Extract the folders "bin" & "lib" from the zip on top the existing Proguard installation in the SDK Tools Proguard folders "bin" & "lib", should be around here (Win x64):
C:\Program Files (x86)\Google\Android SDK\tools\proguard
Labels:
Android
Monday, June 20, 2011
Android SDK Error: Unable to resolve target 'Google Inc.:Google APIs:X'
I the past I wrote a post on a similar issue, but here goes -
There are few variants of this error message:
Unable to resolve target 'Google Inc.:Google APIs:1'
Unable to resolve target 'Google Inc.:Google APIs:2'
Unable to resolve target 'Google Inc.:Google APIs:3'
Unable to resolve target 'Google Inc.:Google APIs:4'
Unable to resolve target 'Google Inc.:Google APIs:5'
Unable to resolve target 'Google Inc.:Google APIs:6'
Unable to resolve target 'Google Inc.:Google APIs:7'
Unable to resolve target 'Google Inc.:Google APIs:8'
Unable to resolve target 'Google Inc.:Google APIs:9'
Unable to resolve target 'Google Inc.:Google APIs:10'
Unable to resolve target 'Google Inc.:Google APIs:11'
Unable to resolve target 'Google Inc.:Google APIs:12'
Unable to resolve target 'Google Inc.:Google APIs:13'
Unable to resolve target 'Google Inc.:Google APIs:14'
Unable to resolve target 'Google Inc.:Google APIs:15'
Unable to resolve target 'Google Inc.:Google APIs:16'
Unable to resolve target 'Google Inc.:Google APIs:17'
Unable to resolve target 'Google Inc.:Google APIs:18'
Unable to resolve target 'Google Inc.:Google APIs:19'
Unable to resolve target 'Google Inc.:Google APIs:20'
Unable to resolve target 'Google Inc.:Google APIs:21'
Reason: Could not find the proper Google APIs Android SDK version. If the android SDK is installed correctly the problem is that the platform SDK requested by the "AndroidManifest.xml" android:minSdkVersion is not installed. For example:
'Google Inc.:Google APIs:1' - change the Android SDK in the project properties
'Google Inc.:Google APIs:2' - change the Android SDK in the project properties
'Google Inc.:Google APIs:3' - install Google APIs SDK Android 1.5
'Google Inc.:Google APIs:4' - install Google APIs SDK Android 1.6
'Google Inc.:Google APIs:5' - install Google APIs SDK Android 2.0
'Google Inc.:Google APIs:6' - install Google APIs SDK Android 2.0.1
'Google Inc.:Google APIs:7' - install Google APIs SDK Android 2.1
'Google Inc.:Google APIs:8' - install Google APIs SDK Android 2.2
'Google Inc.:Google APIs:9' - install Google APIs SDK Android 2.3
'Google Inc.:Google APIs:10' - install Google APIs SDK Android 2.3.3
'Google Inc.:Google APIs:11' - install Google APIs SDK Android 3.0
'Google Inc.:Google APIs:12' - install Google APIs SDK Android 3.1
'Google Inc.:Google APIs:13' - install Google APIs SDK Android 3.2
'Google Inc.:Google APIs:14' - install Google APIs SDK Android 4.0
'Google Inc.:Google APIs:15' - install Google APIs SDK Android 4.0.3
'Google Inc.:Google APIs:16' - install Google APIs SDK Android 4.1
'Google Inc.:Google APIs:17' - install Google APIs SDK Android 4.2
'Google Inc.:Google APIs:18' - install Google APIs SDK Android 4.3
'Google Inc.:Google APIs:19' - install Google APIs SDK Android 4.4
'Google Inc.:Google APIs:20' - change the Android SDK in the project properties
'Google Inc.:Google APIs:21' - install Google APIs SDK Android 5.0.1
You can do this using the Android SDK Setup utility:
Option 1: Eclipse -
"Windows" -> "Android SDK and AVD Manager" -> "Available packages" -> "Third Party" -> "Google"
Option 2: Command line - start the "SDK Setup" here (x86):
C:\Program Files\Google\Android SDK\SDK Setup.exe
or here (x64)
C:\Program Files (x86)\Google\Android SDK\SDK Setup.exe
There are few variants of this error message:
Unable to resolve target 'Google Inc.:Google APIs:1'
Unable to resolve target 'Google Inc.:Google APIs:2'
Unable to resolve target 'Google Inc.:Google APIs:3'
Unable to resolve target 'Google Inc.:Google APIs:4'
Unable to resolve target 'Google Inc.:Google APIs:5'
Unable to resolve target 'Google Inc.:Google APIs:6'
Unable to resolve target 'Google Inc.:Google APIs:7'
Unable to resolve target 'Google Inc.:Google APIs:8'
Unable to resolve target 'Google Inc.:Google APIs:9'
Unable to resolve target 'Google Inc.:Google APIs:10'
Unable to resolve target 'Google Inc.:Google APIs:11'
Unable to resolve target 'Google Inc.:Google APIs:12'
Unable to resolve target 'Google Inc.:Google APIs:13'
Unable to resolve target 'Google Inc.:Google APIs:14'
Unable to resolve target 'Google Inc.:Google APIs:15'
Unable to resolve target 'Google Inc.:Google APIs:16'
Unable to resolve target 'Google Inc.:Google APIs:17'
Unable to resolve target 'Google Inc.:Google APIs:18'
Unable to resolve target 'Google Inc.:Google APIs:19'
Unable to resolve target 'Google Inc.:Google APIs:20'
Unable to resolve target 'Google Inc.:Google APIs:21'
Reason: Could not find the proper Google APIs Android SDK version. If the android SDK is installed correctly the problem is that the platform SDK requested by the "AndroidManifest.xml" android:minSdkVersion is not installed. For example:
'Google Inc.:Google APIs:1' - change the Android SDK in the project properties
'Google Inc.:Google APIs:2' - change the Android SDK in the project properties
'Google Inc.:Google APIs:3' - install Google APIs SDK Android 1.5
'Google Inc.:Google APIs:4' - install Google APIs SDK Android 1.6
'Google Inc.:Google APIs:5' - install Google APIs SDK Android 2.0
'Google Inc.:Google APIs:6' - install Google APIs SDK Android 2.0.1
'Google Inc.:Google APIs:7' - install Google APIs SDK Android 2.1
'Google Inc.:Google APIs:8' - install Google APIs SDK Android 2.2
'Google Inc.:Google APIs:9' - install Google APIs SDK Android 2.3
'Google Inc.:Google APIs:10' - install Google APIs SDK Android 2.3.3
'Google Inc.:Google APIs:11' - install Google APIs SDK Android 3.0
'Google Inc.:Google APIs:12' - install Google APIs SDK Android 3.1
'Google Inc.:Google APIs:13' - install Google APIs SDK Android 3.2
'Google Inc.:Google APIs:14' - install Google APIs SDK Android 4.0
'Google Inc.:Google APIs:15' - install Google APIs SDK Android 4.0.3
'Google Inc.:Google APIs:16' - install Google APIs SDK Android 4.1
'Google Inc.:Google APIs:17' - install Google APIs SDK Android 4.2
'Google Inc.:Google APIs:18' - install Google APIs SDK Android 4.3
'Google Inc.:Google APIs:19' - install Google APIs SDK Android 4.4
'Google Inc.:Google APIs:20' - change the Android SDK in the project properties
'Google Inc.:Google APIs:21' - install Google APIs SDK Android 5.0.1
You can do this using the Android SDK Setup utility:
Option 1: Eclipse -
"Windows" -> "Android SDK and AVD Manager" -> "Available packages" -> "Third Party" -> "Google"
Option 2: Command line - start the "SDK Setup" here (x86):
C:\Program Files\Google\Android SDK\SDK Setup.exe
or here (x64)
C:\Program Files (x86)\Google\Android SDK\SDK Setup.exe
Labels:
Android
Wednesday, June 1, 2011
getCacheTotalSize causes NullPointerException
After starting to use a new AdMob SDK I noticed the following exception in the Android Market Developer Console:http://www.blogger.com/img/blank.gif
java.lang.NullPointerException
at android.webkit.WebViewDatabase.getCacheTotalSize(WebViewDatabase.java:735)
at android.webkit.CacheManager.trimCacheIfNeeded(CacheManager.java:557)
at android.webkit.WebViewWorker.handleMessage(WebViewWorker.java:195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.os.HandlerThread.run(HandlerThread.java:60)
I solved it using a suggestion I found online. You can use other ways to disable the ads, depending which SDK you use:
Anyhow, as far as I remember this issue was fixed in the Android OS 2.3+, so until this OS version will catch you have to disable the ads to people with this problem.
java.lang.NullPointerException
at android.webkit.WebViewDatabase.getCacheTotalSize(WebViewDatabase.java:735)
at android.webkit.CacheManager.trimCacheIfNeeded(CacheManager.java:557)
at android.webkit.WebViewWorker.handleMessage(WebViewWorker.java:195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.os.HandlerThread.run(HandlerThread.java:60)
I solved it using a suggestion I found online. You can use other ways to disable the ads, depending which SDK you use:
WebViewDatabase webViewDB = WebViewDatabase.getInstance(this);
if (webViewDB == null) {
View adView = findViewById(R.id.adView);
if (adView != null)
adView.setVisibility(View.GONE);
}
Anyhow, as far as I remember this issue was fixed in the Android OS 2.3+, so until this OS version will catch you have to disable the ads to people with this problem.
Labels:
Android
Tuesday, May 24, 2011
Improving Remote Desktop speed on Vista/Win7
A fellow kept complaining that his Remote Desktop (mstsc) connection to the office is super slow. I told him that I had the same problem since I moved from Windows XP to Windows 7 & he found the following solution:
Run the following command line:
netsh interface tcp set global autotuninglevel=disabled
to undo it:
netsh interface tcp set global autotuninglevel=normal
For full details check this post. It's not optimal, but it works & I didn't notice any problem since.
Run the following command line:
netsh interface tcp set global autotuninglevel=disabled
to undo it:
netsh interface tcp set global autotuninglevel=normal
For full details check this post. It's not optimal, but it works & I didn't notice any problem since.
Labels:
RDP,
Windows 7,
Windows Vista
Friday, May 13, 2011
Memory debugging and Android application
Using DDMS
*. Compile & run the application on an enumlator in debug (e.g. Manifest.xml, android:debuggable="true").
*. open DDMS
Checking the heap status:
*. Select your application, click on 'Show heap updates' on the toolbar.
*. Play around with your application and check the results.
Checking the allocations:
*. Select the allocation tracker tab, click on 'Start Tracking'
*. Press 'Get Allocations' when you want to check the allocations.
Note: do not use both heap status & allocations - the heap monitoring will cause a lot of allocations.
*. Compile & run the application on an enumlator in debug (e.g. Manifest.xml, android:debuggable="true").
*. open DDMS
Checking the heap status:
*. Select your application, click on 'Show heap updates' on the toolbar.
*. Play around with your application and check the results.
Checking the allocations:
*. Select the allocation tracker tab, click on 'Start Tracking'
*. Press 'Get Allocations' when you want to check the allocations.
Note: do not use both heap status & allocations - the heap monitoring will cause a lot of allocations.
Labels:
Android
Tuesday, May 3, 2011
Display ListPreference value in the preferences screen
One missing feature in the preferences activity in Android applications is to display the selected value of a ListPreference. By default, to view the selected value of a ListPreference you must click the preference and see what's selected in the combo box.
Here's an example how to create a preferences activity which displays the selected value of any number of ListPreferences in the activity.
Notes:
Here's an example how to create a preferences activity which displays the selected value of any number of ListPreferences in the activity.
public class MyPreferenceActivity extends PreferenceActivity
implements SharedPreferences.OnSharedPreferenceChangeListener {
private ArrayList<ListPreference> mListPreferences;
private String[] mListPreferencesKeys = new String[] {
"prefKey1", // The 'android:key' value of the ListPreference
"prefKey2" // The 'android:key' value of the ListPreference
....
....
....
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
mListPreferences = new ArrayList<ListPreference>();
SharedPreferences sharedPrefs = getPreferenceManager().getSharedPreferences();
sharedPrefs.registerOnSharedPreferenceChangeListener(this);
for (String prefKey : mListPreferencesKeys) {
ListPreference pref = (ListPreference)getPreferenceManager().findPreference(prefKey);
mListPreferences.add(pref);
onSharedPreferenceChanged(sharedPrefs, prefKey);
}
}
@Override
public void onSharedPreferenceChanged(SharedPreferences pref, String prefKey) {
for (ListPreference listPref : mListPreferences) {
if (listPref.getKey().equals(prefKey))
listPref.setSummary(listPref.getEntry());
}
}
}
Notes:
- This code will update the values if the user selects a new value
- If you're defining preferences keys in the strings.xml file, make the mListPreferencesKeys list an integer list, and get the string at run time using 'getString'
Labels:
Android
Wednesday, April 20, 2011
Problem uninstalling android application
From time to time I'm facing an application that refuses to uninstall using the market. Here is the procedure I'm using (if any step works - there's no need to continue):
- Uninstall using the Android Market application
- Uninstall using the settings menu from the home screen: 'Menu' -> 'Settings' -> 'Applications' -> 'Manage Applications' -> select the application & uninstall.
- Uninstall using a 3rd party tool, for example: ASTRO file manager (in the application click 'Menu' -> 'Tools' -> 'Application Manager/Backup' -> long click the application -> 'Uninstall')
- Reboot the phone and try steps 2 & 3 again.
Labels:
Android
Subscribe to:
Posts (Atom)