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 7190329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:29:26+00:00 2026-05-28T19:29:26+00:00

I need the bugreport option that you can use in adb to go to

  • 0

I need the bugreport option that you can use in adb to go to a file on the sd in my app. I found Android; using exec("bugreport") that explains that you can not run bugreport in the regular shell and that you need to run dumpstate, dumpsys, and logcat separately to get the same result. That is fine and I understand that, but I can not get dumpstate or dumpsys to write to the file. The below works fine to write the logcat using logcat -d -f, but does not work for the other two. I have tried dumpstate -f , dumpstate -d -f and dumpstate > to get it work, but still does not write anything to the file. Is there something I am missing to make this work?
This is where I am creating the file on the sd

File folder = new File(Environment.getExternalStorageDirectory()+"/IssueReport/");
    if (folder.isDirectory() == false) {
        folder.mkdir();
    }
    log = new File(Environment.getExternalStorageDirectory()+"/IssueReport/log.txt");

and here is where I am writing the file to the location

private void submit() {
    try {
       log.createNewFile(); 
       String cmd = "dumpstate "+log.getAbsolutePath();
       Runtime.getRuntime().exec(cmd);
    } catch (IOException e) {
    e.printStackTrace();
    }
  • 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-05-28T19:29:27+00:00Added an answer on May 28, 2026 at 7:29 pm

    I got it working. I found Running Shell commands though java code on Android? and modified it to work like I needed it to.

    private void submit() {
        try {
             String[] commands = {"dumpstate > /sdcard/log1.txt"};
             Process p = Runtime.getRuntime().exec("/system/bin/sh -");
             DataOutputStream os = new DataOutputStream(p.getOutputStream());
                for (String tmpCmd : commands) {
                    os.writeBytes(tmpCmd+"\n");
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
    

    If anyone needs it, here is the way I am running everything together. The app needs to have a bug report attached to it, from reading Running Shell commands though java code on Android? , I saw that there is not a way to run a bug report, just the three componenets: dumpstate, dumpsys, and log. I am generating each report separately and then combining them all into one file to attach to an email.

    private void submit() {
        try {
             String[] commands = {"dumpstate > /sdcard/IssueReport/dumpstate.txt", 
                                  "dumpsys > /sdcard/IssueReport/dumpsys.txt",
                                  "logcat -d > /sdcard/IssueReport/log.txt",
                                  "cat /sdcard/IssueReport/dumpstate.txt /sdcard/IssueReport/dumpsys.txt /sdcard/IssueReport/log.txt > /sdcard/IssueReport/bugreport.rtf" };
             Process p = Runtime.getRuntime().exec("/system/bin/sh -");
             DataOutputStream os = new DataOutputStream(p.getOutputStream());
                for (String tmpCmd : commands) {
                        os.writeBytes(tmpCmd+"\n");
                }
            } catch (IOException e) {
                e.printStackTrace();    
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a macro that conveniently builds lambda functions using which I can iterate
Need to be able to read an Excel file uploaded using FileUploadControl in ASP.NET.
I hit a bug when using Puppet and stored configs that can be be
Need to implement an app that has a feature to play sounds. Each sound
Need to apply a filter to a file like this: TUPAC_0006:1:1:2554:2356#0/1 0 * 0
Need help with a query that I wrote: I have three tables Company id
Let's say I need to access a web service from an iPhone app. This
I've found small bug in tinymce styleselect. I've submitted bugreport already (http://tinymce.moxiecode.com/develop/bugtracker_view.php?id=4576) but I
I have the following code fragment that I use to scale images. This is
Need to load data from a single file with a 100,000+ records into multiple

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.