Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8483055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:58:59+00:00 2026-06-10T19:58:59+00:00

I am trying to copy database from assets folder in my application. Code works

  • 0

I am trying to copy database from assets folder in my application. Code works perfectly on Android 2.1/2.3 but while i execute same code on Android 2.2 device its throws following exception :

09-03 15:54:09.762: I/System.out(610): File Created successfully
09-03 15:54:09.762: D/asset(610): Data exceeds UNCOMPRESS_DATA_MAX (4640768 vs 1048576)
09-03 15:54:09.762: W/System.err(610): java.io.IOException
09-03 15:54:09.782: W/System.err(610):  at android.content.res.AssetManager.readAsset(Native Method)
09-03 15:54:09.782: W/System.err(610):  at android.content.res.AssetManager.access$700(AssetManager.java:36)
09-03 15:54:09.862: D/dalvikvm(610): GC_FOR_MALLOC freed 2198 objects / 260688 bytes in 71ms
09-03 15:54:09.862: W/System.err(610):  at android.content.res.AssetManager$AssetInputStream.read(AssetManager.java:571)
09-03 15:54:09.862: W/System.err(610):  at com.emobi.metro.Help.createDatabase(Help.java:39)
09-03 15:54:09.862: W/System.err(610):  at com.emobi.metro.Help.<init>(Help.java:22)
09-03 15:54:09.862: W/System.err(610):  at com.emobi.metro.Fair.onCreate(Fair.java:41)
09-03 15:54:09.862: W/System.err(610):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-03 15:54:09.862: W/System.err(610):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
09-03 15:54:09.862: W/System.err(610):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
09-03 15:54:09.862: W/System.err(610):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-03 15:54:09.862: W/System.err(610):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-03 15:54:09.862: W/System.err(610):  at android.os.Handler.dispatchMessage(Handler.java:99)
09-03 15:54:09.862: W/System.err(610):  at android.os.Looper.loop(Looper.java:123)
09-03 15:54:09.862: W/System.err(610):  at android.app.ActivityThread.main(ActivityThread.java:4627)
09-03 15:54:09.862: W/System.err(610):  at java.lang.reflect.Method.invokeNative(Native Method)
09-03 15:54:09.862: W/System.err(610):  at java.lang.reflect.Method.invoke(Method.java:521)
09-03 15:54:09.862: W/System.err(610):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-03 15:54:09.862: W/System.err(610):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-03 15:54:09.862: W/System.err(610):  at dalvik.system.NativeStart.main(Native Method)

Following function is used to copy DB from assets:

private void createDatabase() {
    File DbFile = new File(
            "data/data/com.emobi.metro/databases/mymetro");
    if (DbFile.exists()) {
        System.out.println("file already exist ,No need to Create");
    } else {
        try {
            DbFile.createNewFile();
            System.out.println("File Created successfully");
            InputStream is = context.getAssets().open(databasename);
            FileOutputStream fos = new FileOutputStream(DbFile);
            byte[] buffer = new byte[1024];
            int length = 0;
            while ((length = is.read(buffer)) > 0) {
                fos.write(buffer, 0, length);
            }
            System.out.println("File succesfully placed on sdcard");
            // Close the streams
            fos.flush();
            fos.close();
            is.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}

Yes i tried that too but then i get following Exception
09-03 16:14:26.652: E/AndroidRuntime(2165): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.emobi.metro/com.emobi.metro.Fair}: android.database.sqlite.SQLiteException: no such table: fair: , while compiling: select stations from fair

Which is available in Database.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:59:01+00:00Added an answer on June 10, 2026 at 7:59 pm

    There is many possible solutions to be found on the web, here is a good discussion on stackoverflow: I get this error: Data exceeds UNCOMPRESS_DATA_MAX on android 2.2 but not on 2.3

    It seems to be related to android compressing files above 1 mb.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to copy a 5mb database file to data folder from raw
I've been trying to pull a copy of my sqlite database from my android
I'm Unable to copy SQLite database from assests folder to device memory(trying on emulator).
Trying to insert data in database from edittext in android but data is not
I am trying to copy all format file (.txt,.pdf,.doc ...) file from source folder
I'm trying to copy SQL database from one server to another. Please tell me
I am trying to copy a database with huge data from SQL Server 2005
I am trying to copy all the tables and views from a database on
Im trying to copy over data from one table to another in the same
I'm trying to generate scripts from a database, but with slight modifications to those

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.