/storage/emulated/o/tencencent/qqlite/no storage是什么意思思

/storage/emulated/o/tencencent/qqlite/是什么意思_百度知道
/storage/emulated/o/tencencent/qqlite/是什么意思
我有更好的答案
按默认排序
存储/ o /模拟/ tencencent / qqlite &#47&#47
其他类似问题
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
I am presently working on an WiFi application for Android. I am having trouble trying to access the database on the device. Debugging in the emulator doesn't work for me, because there is no WiFi support in the emulator. I tried pulling the database file out of the device by using
adb pull data/data/package-name/databases/database-name
But I get the error "Permission denied.".
In this answer , Commonsware has suggested to pull database file by running in debug mode. But it doesn't work too. Any help on how to debug the database without rooting the device would be much appreciated.
11.9k134966
I'll repeat myself from :
Starting from API level 8 (Android 2.2), if you build the application as debuggable, you can use the shell run-as command to run a command or executable as a specific user/application or just switch to the UID of your application so you can access its data directory.
So if you wish to pull your application database from the device you should run the application in the debug mode (to do so, simply run it from the Eclipse), connect with adb -d shell and run the following commands:
run-as package-name
cat /data/data/package-name/databases/database-name &/sdcard/database-name
This will copy yourdatabase.db to the root of your SD card. Now you can easily get it from there (by using USB storage, adb pull or whatever else you like).
UPDATE @Shiki provided a convenient one-liner one can use without entering the adb shell:
adb -d shell 'run-as com.yourpackage cat /data/data/com.yourpackage/databases/dbname.sqlite & /sdcard/dbname.sqlite'
14.2k75383
I use this shell script on my MAC, that copies database directly to my home folder. Easy one click solution, just change package name (com.example.app) and database name (database.sqlite)
Simple Script
#!/bin/bash
adb -d shell 'run-as com.example.app cat /data/data/com.example.app/databases/database.sqlite & /sdcard/database.sqlite'
adb pull /sdcard/database.sqlite ~/
Script which accepts arguments [package_name] [database]
#!/bin/bash
REQUIRED_ARGS=2
ADB_PATH=/Users/Tadas/Library/sdk/platform-tools/adb
PULL_DIR="~/"
if [ $# -ne $REQUIRED_ARGS ]
echo "Usage:"
echo "android_db_move.sh [package_name] [db_name]"
echo "eg. android_db_move.sh lt.appcamp.impuls impuls.db"
cmd1="$ADB_PATH -d shell 'run-as $1 cat /data/data/$1/databases/$2 & /sdcard/$2' "
cmd2="$ADB_PATH pull /sdcard/$2 $PULL_DIR"
echo $cmd1
eval $cmd1
if [ $? -eq 0 ]
echo ".........OK"
echo $cmd2
eval $cmd2
if [ $? -eq 0 ]
echo ".........OK"
The best way to view and manage you android app database is to use this library
With this library you can manage your app SQLite database from you app itself.
you can view the tables in your app database , update ,delete, insert rows to your tables .Everything from your app.
Its a single java activity file ,just add the java file to your source folder.When the development is done remove the java file from your src folder thats it .
It helped me a lot .Hope it helps you too .
You can view the 1 minute demo here :
In my application I export the database to the SD card.
Once the database is on the SD card it can be accessed by plugging the device into your computer.
Look at this post:
2,97822857
There is a way if an apk is debuggable to use a program called run-as from the (non-root) adb shell to copy an application's private file.
27.6k43572
If you get
The system cannot find the path specified.
adb -d shell "run-as com.yourpackage cat /data/data/com.yourpackage/databases/dbname.sqlite & /sdcard/dbname.sqlite"
Note the double quote!
3,57411019
I simply did:
$ adb shell
shell@android:/ $ run-as myapp.package.name sh
shell@android:/data/data/myapp.package.name $
Then I can debug an sqlite database or whatever I wanna do from shell with the right permissions.
1,81111233
You need to be running adb as root, or be using it on a rooted phone.
To run adb as root, use adb root
11.6k36124229
Here is step by step instructions - mostly taken from a combination of the other answers. This works with devices that are not unlocked.
Connect your device and launch the application in debug mode.
Copy the database file from your application folder to your sd card: execute:
./adb -d shell 'run-as com.yourpackge.name cat /data/data/com.yourpackge.name/databases/filename.sqlite > /sdcard/filename.sqlite'
Pull the database files to your machine: execute:
./adb pull /sdcard/ execute: ./adb
Install Firefox SQLLite Manager:
Open Firefox SQLLite Manager and open your database file from step 3 above.
None of the run-as-and-cat-to-sdcard solutions worked for me on Android 4.4.2. I'm not sure, but I suspect it may be due to the run-as tool not correctly handling the new sdcard_r and sdcard_rw permissions.
I first had to copy the database file to /files in my application's private internal storage:
shell@hammerhead:/ $ run-as com.example.myapp
shell@hammerhead:/data/data/com.example.myapp $ cp databases/mydb files/mydb
Then I copied to /sdcard/Android/data/com.example.myapp/files in Javaland (this requires the WRITE_EXTERNAL_STORAGE permission):
public class MainActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
if (isExternalStorageWritable()) {
final FileInputS
input = openFileInput("mydb");
File output = new File(getExternalFilesDir(null), "mydb");
copy(input, output);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
public void copy(FileInputStream in, File dst) throws IOException {
OutputStream out = new FileOutputStream(dst);
// Transfer bytes from in to out
byte[] buf = new byte[1024];
while ((len = in.read(buf)) & 0) {
out.write(buf, 0, len);
in.close();
out.close();
public boolean isExternalStorageWritable() {
String state = Environment.getExternalStorageState();
return Environment.MEDIA_MOUNTED.equals(state);
Finally, I copied the file to my laptop:
$ adb pull /sdcard/Android/data/com.example.myapp/files/mydb
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabledExport SQLite data from your Android device - TechRepublic
A couple of weeks ago I wrote an article about how to . But what happens when you need to get
data from an actual Android device? Well, unless that device is rooted, you won't
be able to get to the data using Eclipse and the
(DDMS); you'll need to be able to push the data to the
device's SD memory. That's where this tutorial can help.
Follow along with the step-by-step instructions, or
and import the entire project into Eclipse.
1. Create a new Android project in Eclipse. Target Android
2.2 or higher.
2. In order to access the SD card, your application will
need to request permission in the AndroidManifest.xml file.
AndroidManifest.xml
&manifest xmlns:android="/apk/res/android"
package="com.authorwjf.sqliteexport"
android:versionCode="1"
android:versionName="1.0" &
android:minSdkVersion="8"
android:targetSdkVersion="15" /&
&uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&
&uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&
&application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" &
android:name="com.authorwjf.sqliteexport.MainActivity"
android:label="@string/title_activity_main" &
&intent-filter&
&action android:name="android.intent.action.MAIN" /&
&category android:name="android.intent.category.LAUNCHER" /&
&/intent-filter&
&/activity&
&/application&
&/manifest&
3. In the /res/layout folder, open the activity_main.xml
file. For this demo, we are simply stacking three buttons inside a linear
activity_main.xml
&LinearLayout xmlns:android="/apk/res/android"
android:orientation="vertical"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent" &
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SQLite DB to SD Demo"/&
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Export" /&
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Create" /&
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Delete" /&
&/LinearLayout&
4. Open the /src/MainActivity.java file and create an
activity that implements the on click handler. Wire up the buttons in the on
create override.
MainActivity.java
package com.authorwjf.
import java.io.F
import java.io.FileInputS
import java.io.FileOutputS
import java.io.IOE
import java.nio.channels.FileC
import android.os.B
import android.os.E
import android.view.V
import android.view.View.OnClickL
import android.widget.T
import android.app.A
import android.database.sqlite.SQLiteD
public class MainActivity extends Activity implements OnClickListener {
private static final String SAMPLE_DB_NAME = "TrekBook";
private static final String SAMPLE_TABLE_NAME = "Info";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.button1).setOnClickListener(this);
findViewById(R.id.button2).setOnClickListener(this);
findViewById(R.id.button3).setOnClickListener(this);
public void onClick(View v) {
switch(v.getId()) {
case R.id.button1:
deleteDB();
case R.id.button2:
exportDB();
case R.id.button3:
createDB();
5. It's time to implement our three private worker
functions. Let's start with delete, since it's the easiest.
private void deleteDB(){
boolean result = this.deleteDatabase(SAMPLE_DB_NAME);
if (result==true) {
Toast.makeText(this, "DB Deleted!", Toast.LENGTH_LONG).show();
6. Next we'll implement the create db function. For our
purposes, we are using raw sql to create a canned database with a single table
and data row.private void createDB() {
SQLiteDatabase sampleDB =
this.openOrCreateDatabase(SAMPLE_DB_NAME, MODE_PRIVATE, null);
sampleDB.execSQL("CREATE TABLE IF NOT EXISTS " +
SAMPLE_TABLE_NAME +
" (LastName VARCHAR, FirstName VARCHAR," +
" Rank VARCHAR);");
sampleDB.execSQL("INSERT INTO " +
SAMPLE_TABLE_NAME +
" Values ('Kirk','James, T','Captain');");
sampleDB.close();
sampleDB.getPath();
Toast.makeText(this, "DB Created @ "+sampleDB.getPath(), Toast.LENGTH_LONG).show();
7. We come to our export data function. If you read the
documentation for writing to the SD card, you will see my method differs a
little from the recommended technique. Google recommends checking the Environment.getExternalStorageDirectory().canWrite() method
before attempting to copy to the device's external storage. In my experience,
this is unreliable. The return value of this method is determined by the
hardware manufacturer, and I have found many cases (including the Nexus 4)
where the method returns false, but the write works just fine. My advice is to
just wrap the whole block in a try catch.private void exportDB(){
File sd = Environment.getExternalStorageDirectory();
File data = Environment.getDataDirectory();
FileChannel source=
FileChannel destination=
String currentDBPath = "/data/"+ "com.authorwjf.sqliteexport" +"/databases/"+SAMPLE_DB_NAME;
String backupDBPath = SAMPLE_DB_NAME;
File currentDB = new File(data, currentDBPath);
File backupDB = new File(sd, backupDBPath);
source = new FileInputStream(currentDB).getChannel();
destination = new FileOutputStream(backupDB).getChannel();
destination.transferFrom(source, 0, source.size());
source.close();
destination.close();
Toast.makeText(this, "DB Exported!", Toast.LENGTH_LONG).show();
} catch(IOException e) {
e.printStackTrace();
Now you are ready to give it a try. Remember, this code is
meant to run on a device, not the emulator (though it is possible to make it
work on an emulator if you configure it with emulated external storage).
Once you export the database, you will need to connect the
device to a PC in mass storage mode in order to transfer the database. Once you
have the file on your PC, you can follow the instructions in my
to browse it.
About William J. Francis
William J Francis began programming computers at age eleven. Specializing in embedded and mobile platforms, he has more than 20 years of professional software engineering under his belt, including a four year stint in the US Army's Military Intellige...
William J Francis began programming computers at age eleven. Specializing in embedded and mobile platforms, he has more than 20 years of professional software engineering under his belt, including a four year stint in the US Army's Military Intelligence Corps.
Throughout his career William has published numerous technical articles, as well as the occasional short story.
Post commentStack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Okay, now i'm really stuck here. I don't know what to do, where to go or ANYTHING!
I have been trying to uninstall, reinstall, both SDK and Eclipse-versions, trying to Google this out, but nu-uh... Nothing!!!
I CAN run my app in emulator, but i cant EXPORT it...
[ 16:35:30 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/dreamhawk/kalori/DataBaseH
this is dataBaseHelper
package com.dreamhawk.
import java.io.FileOutputS
import java.io.IOE
import java.io.InputS
import java.io.OutputS
import android.content.C
import android.database.C
import android.database.SQLE
import android.database.sqlite.SQLiteD
import android.database.sqlite.SQLiteE
import android.database.sqlite.SQLiteOpenH
import android.util.L
import android.widget.T
public class DataBaseHelper extends SQLiteOpenHelper {
// The Android's default system path of your application database.
private static String DB_PATH = "/data/data/com.dreamhawk.kalori/databases/";
private static String DB_NAME = "livsmedel_db";
private DataBaseHelper myDBH
private SQLiteDatabase myDb;
private final Context myC
private static final String DATABASE_TABLE = "Livsmedel";
public static String DB_FILEPATH = "/data/data/com.dreamhawk.kalori/databases/lifemedel_db";
public static final String KEY_TITLE = "Namn";
public static final String KEY_BODY = "Kcal";
public static final String KEY_ROWID = "_id";
private static final int DATABASE_VERSION = 2;
* Constructor Takes and keeps a reference of the passed context in order to
* access to the application assets and resources.
* @param context
public DataBaseHelper(Context context) {
super(context, DB_NAME, null, 1);
this.myContext =
// checking database and open it if exists
if (checkDataBase()) {
openDataBase();
this.getReadableDatabase();
createDatabase();
this.close();
openDataBase();
} catch (IOException e) {
throw new Error("Error copying database");
Toast.makeText(context, "Livsmedelsdatabasen importerad",
Toast.LENGTH_LONG).show();
private boolean checkDataBase() {
SQLiteDatabase checkDB =
boolean exist =
String dbPath = DB_PATH + DB_NAME;
checkDB = SQLiteDatabase.openDatabase(dbPath, null,
SQLiteDatabase.OPEN_READONLY);
} catch (SQLiteException e) {
Log.v("db log", "database does't exist");
if (checkDB != null) {
checkDB.close();
public void onCreate(SQLiteDatabase db) {
// db.execSQL(DATABASE_CREATE);
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.w("Kalori", "Upgrading database from version " + oldVersion + " to "
+ newVersion + ", which will destroy all old data");
db.execSQL("DROP TABLE IF EXISTS Livsmedel");
onCreate(db);
public DataBaseHelper open() throws SQLException {
myDBHelper = new DataBaseHelper(myContext);
myDb = myDBHelper.getWritableDatabase();
public void createDatabase() throws IOException {
InputStream assetsDB = myContext.getAssets().open("livsmedel_db");
// OutputStream dbOut = new FileOutputStream(DB_PATH);
String outFileName = DB_PATH + DB_NAME;
OutputStream dbOut = new FileOutputStream(outFileName);
Log.d("DH", "index=" + assetsDB);
byte[] buffer = new byte[1024];
while ((length = assetsDB.read(buffer)) & 0) {
dbOut.write(buffer, 0, length);
dbOut.flush();
dbOut.close();
assetsDB.close();
public Cursor fetchAllNotes() {
return myDb.query(DATABASE_TABLE, new String[] { KEY_ROWID, KEY_TITLE,
KEY_BODY }, null, null, null, null, null);
public void openDataBase() throws SQLException {
String dbPath = DB_PATH + DB_NAME;
myDb = SQLiteDatabase.openDatabase(dbPath, null,
SQLiteDatabase.OPEN_READWRITE);
I suspect:
import java.io.FileOutputS
import java.io.IOE
import java.io.InputS
import java.io.OutputS
But I don't know what to do... Please help !!! :'(
I updated eclipse (Help-&Check for updates) today (21st October,2011) and now I don't see the error. Before it I had error "Unable to execute dex: Multiple dex files define". Hope this helps.
2,21311435
There is a file in bin/dexedLibs
The same file exists in libs
Delete it in libs and it should work.
For me it was the android-support-v4.jar.
Hope this helps
Fixed it by following simple steps
right click project
go to properties
click Java Build Path
on 'order and export' tab uncheck jar files and dependencies
rebuilt project.
Restart eclipse,
Delete bin & gen folder and
Finally clean up the project and build it again.
This worked for me.. :)
Problem solved.
Before upgrading, I had 3 android projects: App1, App2 and Lib. Lib is an Android Library project and App1 and App2 use it.
After upgrading both ADT and SDK I saw errors like
[ 15:54:10 - Dex Loader] Unable to execute dex: Multiple dex files define L
[ 15:54:10 - TrailGuide] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define L
The solution was to remove in both App1 and App2 the folder called "Lib_src".
Both the Library and the App projects contain the same a DataBaseHelper.java file. Just exlude it from the App project.
I had this happen to me when I had two copies of the same lib (I had two different revisions of the Android support library version 4). Once I removed one of them - the project compiled and I was able to run it.
WOW finally...
This error was quite gruesome.
What I did eventually was download the latest version of Eclipse Java EE, then I installed the ADT plugin into the new Eclipse.
Afterwards, I configured my project like normal, and used the exporting guidelines found here:
But anyways I've seen many answers... and the actual problem is extremely difficult to diagnose.
Possibility is that the problems lies in incompatibility between ADT plugin and Eclipse IDE.
I just know that using the most recent versions will make things work (as of Sep 5th, 2012).
Try follow steps:
Disable "Project->Build Automatically" option, then "Clean" and "Build" project, then try to run.
works for me.
can set back "Build Automatically" option to On
I was also seeing the "Multiple dex files define" message. After reading , I deleted the the bin directory for my project, cleaned and rebuilt the project as described by @abbandon above and restarted Eclipse. These steps cleared the problem for me.
1,68231011
for me, I was using Android studio when I hit this issue, I was using Google Admob and Analytics external SDKs.
Now they are shipping them with the kitkat SDK, which caused the conflict, the solution was to open project.iml file and remove the following lines :
&orderEntry type="module-library"&
&root url="jar://$USER_HOME$/Downloads/Ads/lib/amazon-ads-4.0.9.jar!/" /&
&/CLASSES&
&JAVADOC /&
&SOURCES /&
&/library&
&/orderEntry&
&orderEntry type="module-library"&
&root url="jar://$USER_HOME$/Downloads/Folx/application/GoogleAdMobAdsSdk-6.2.1/Add-ons/googleanalyticsandroid/libGoogleAnalyticsV2.jar!/" /&
&/CLASSES&
&JAVADOC /&
&SOURCES /&
&/library&
&/orderEntry&
Hope it helps, take care..
Fixed it by deleting 3rd party libraries from the libs folder.
Initially i tried to build jars of ActionBarSherlock and MenuDrawer using ant but it didn't work.
Deleting these jars from libs directory fixed the bug
In my case there were two different jars files included in libs folder.
I have removed one of them it solve my issue.
if you are importing a support jar from another project you need to go to
*Java Build Path
* on 'order and export' click on the support jar and put it on top of your dependencies
rebuilt project.
In Cordova, in libs folder there is a file that we set in build path. i have updated cordova and update the jar file but forget to delete the old jar file in libs folder. removed the old one and project worked like a charm!
None of the suggestions here resolved it for me.
This was how I fixed it:
Inside the file /proj.android/jni/Application.mk on the 3rd line, it was specifying to build in "mips". I changed this to APP_ABI:=armeabi-v7a so it can find all the prebuilt libraries correctly.
Removed Libs folder in project, new Lib_src folder, import jar again.
and right click project -> Build Path -> Config Build path, selected Libs folder and click Remove, Click Button Add Folder -> select Lib_src -> OK
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabled}

我要回帖

更多关于 emulated是什么意思 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信