2013-11-16

Android download manager

I needed to download files from the Internet.
Therefore I Googled the "Android download manager" and found the following example:
http://www.mysamplecode.com/2012/09/android-downloadmanager-example.html
I copied them into a new ADT DownloadManager project.
Some errors appeared:
    -import com.google.gson.Gson error

Some library was missing.
Again, googled Jason and downloaded google-gson-2.2.2-release,
and included it in the Java Build Path Library of DownloadManager Project.
Rebuilt project. Error showed:
    -DownloadManager.Request API level error, minimum 9

I changed android:minSdkVersion from 8 to 9 in the AandriodManifest.xml file.
And clicked "Debug As". More error on this point:
-request.setDestinationInExternalFilesDir error, Unable to create external files directory - ANDROID

I started Android Virtual Device Manager and set SD Card Size to 100 MB, restarted simulator.
No more errors!

沒有留言:

張貼留言