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

  • SEARCH
  • Home
  • 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 7802605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:18:53+00:00 2026-06-02T01:18:53+00:00

So I am building an app which have a File Transfer application which allows

  • 0

So I am building an app which have a File Transfer application which allows you to transfer files from one folder inside the main folder to another. However, I am getting this error “VM won’t let us allocate … bytes”.

Logcat Errors:

04-16 16:32:06.072: E/dalvikvm-heap(17644): 184440-byte external allocation too large for this process.
04-16 16:32:06.132: E/GraphicsJNI(17644): VM won't let us allocate 184440 bytes

Does anyone have a solution to overcome this? I saw several postings about images but not files.

Adding code: (As requested). Take note that this code is also copied elsewhere but there are a few modifications I made off my own.

private static void copyFile(File sourceFile, File destFile)
            throws IOException {
    if (!sourceFile.exists()) {
            return;
    }
    if (!destFile.exists()) {
            destFile.createNewFile();
    }
    destFile = new File(destFile.toString().substring(0, destFile.toString().lastIndexOf('/')));
    FileChannel source = null;
    FileChannel destination = null;
    source = new FileInputStream(sourceFile).getChannel();
    destination = new FileOutputStream(destFile).getChannel();
    if (destination != null && source != null) {
            destination.transferFrom(source, 0, source.size());
    }
    if (source != null) {
            source.close();
    }
    if (destination != null) {
            destination.close();
        }
    }

As people have mentioned the memmory error is an image and yes thank you for finding my emberassing bug. I will rectify it soon after I finished this fileNotFoundException.

Sorry for long wait on the logcat to be updated forgot to add in a try and catch inside the copy file method which another method then catches another error from another method which displayed what was on top:

04-16 18:19:41.322: W/System.err(4989): java.io.FileNotFoundException: /mnt/sdcard/ActivityApp (Is a directory)
04-16 18:19:41.322: W/System.err(4989):     at org.apache.harmony.luni.platform.OSFileSystem.open(Native Method)
04-16 18:19:41.322: W/System.err(4989):     at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:232)
04-16 18:19:41.322: W/System.err(4989):     at java.io.FileOutputStream.<init>(FileOutputStream.java:94)
04-16 18:19:41.322: W/System.err(4989):     at java.io.FileOutputStream.<init>(FileOutputStream.java:66)
04-16 18:19:41.322: W/System.err(4989):     at tab.layout.FileFusionActivity.copyFile(FileFusionActivity.java:107)
04-16 18:19:41.322: W/System.err(4989):     at tab.layout.FileFusionActivity.onListItemClick(FileFusionActivity.java:78)
04-16 18:19:41.322: W/System.err(4989):     at android.app.ListActivity$2.onItemClick(ListActivity.java:319)
04-16 18:19:41.322: W/System.err(4989):     at android.widget.AdapterView.performItemClick(AdapterView.java:284)
04-16 18:19:41.322: W/System.err(4989):     at android.widget.ListView.performItemClick(ListView.java:3513)
04-16 18:19:41.322: W/System.err(4989):     at android.widget.AbsListView$PerformClick.run(AbsListView.java:1812)
04-16 18:19:41.322: W/System.err(4989):     at android.os.Handler.handleCallback(Handler.java:587)
04-16 18:19:41.322: W/System.err(4989):     at android.os.Handler.dispatchMessage(Handler.java:92)
04-16 18:19:41.322: W/System.err(4989):     at android.os.Looper.loop(Looper.java:123)
04-16 18:19:41.322: W/System.err(4989):     at android.app.ActivityThread.main(ActivityThread.java:3683)
04-16 18:19:41.322: W/System.err(4989):     at java.lang.reflect.Method.invokeNative(Native Method)
04-16 18:19:41.322: W/System.err(4989):     at java.lang.reflect.Method.invoke(Method.java:507)
04-16 18:19:41.322: W/System.err(4989):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-16 18:19:41.332: W/System.err(4989):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-16 18:19:41.332: W/System.err(4989):     at dalvik.system.NativeStart.main(Native Method)
  • 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-02T01:18:54+00:00Added an answer on June 2, 2026 at 1:18 am

    EDIT: i should have noticed it before but your log cat proves it. The error is in this line

    destFile = new File(destFile.toString().substring(0, destFile.toString().lastIndexOf('/')));
    

    change it to something like this

     destFile = new File(destFile.toString().substring(0, destFile.toString().lastIndexOf('/')),"hello.dat");
    

    The error you are seeing might not be directly related to the copy process. Have you profiled you app to check the memory usage?
    Another thing you can try is to copy the file in chunks as outlined in this question

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

Sidebar

Related Questions

I am building an iphone app which allows people to update an xml file
I'm building a Flex app which requires me to download files. I have the
I have one freemarker template file which loads all css and js files used
I have an app i building which is a simple naviagtion app. I do
I have an MVC3/EF4.1 app that I'm building which now works fine on my
I'm building a Rails app which creates a bookmarklet file for each user upon
I'm building a small app that calculate hash from any given file to multiple
I'm building a web app in Sinatra and I have a bunch of files
I am building an Android app in which client is selling some mp3 files.
I have two WARS: base-overlay example-app base-overlay has XML config files in src/main/webapp/WEB-INF/spring/*.xml .

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.