[android-developers] Re: URGENT: install sqlite db on Android phone???

2009-07-29 Thread dan raaka
AFAIK there are still dump msgs when things crash in the logcat .. for
Galaxy device

-Dan


On Wed, Jul 29, 2009 at 9:28 AM, Dianne Hackborn wrote:

> If there is an application crashed dialog, there WILL be a stack crawl
> printed in the logcat output.  Always.
>
> Hmm...  I guess unless Samsung removed this. :p
>
>
> On Wed, Jul 29, 2009 at 8:01 AM, Christian S.  wrote:
>
>>
>> 1. This is the logcat record:
>>
>> Android Launch!
>> adb is running normally.
>> Performing com.database.test.v1.Bldatabase activity launch
>> Automatic Target Mode: Unable to detect device compatibility. Please
>> select a target device.
>> Uploading Bldatabase.apk onto device 'I7500OXEy3qBTwH'
>> Installing Bldatabase.apk...
>> Success!
>> Starting activity com.database.test.v1.Bldatabase on device
>> ActivityManager: Starting: Intent { comp={com.database.test.v1/
>> com.database.test.v1.Bldatabase} }
>>
>> So the logcat actually shows no errors at all. The screen on the
>> device however give this "application has stopped" error. Nothing
>> else.
>>
>> 2. Do you have some sample code that would show a step-by-step
>> approach of the way you just described above? (I am a novice that's
>> why ...)
>> How can I directly make the application look for the database on the
>> SD card?
>>
>> On Jul 29, 4:46 pm, Mark Murphy  wrote:
>> > I just tried adb pull on a Google Ion, and you're right -- adb push and
>> > pull do not work.
>> >
>> > Christian S. wrote:
>> > > For installing / running the app on the device I only got the usual
>> > > error that the application has stopped. This is certainly related to
>> > > the missing SQLite database.
>> >
>> > Out of curiosity, what does the Java stack trace tell you? You can get
>> > that via adb logcat, DDMS, or the DDMS perspective in Eclipse.
>> >
>> > > Any further ideas?
>> >
>> > Modify your app to check to see if the database exists, and if not, to
>> > look for the database on the SD card -- if it finds it, copy the
>> > database into the proper spot before using it. That's not terribly
>> > secure, but it should work, at least temporarily.
>> >
>> > --
>> > Mark Murphy (a Commons Guy)http://commonsware.com|
>> http://twitter.com/commonsguy
>> >
>> > _Android Programming Tutorials_ Version 1.0 Available!
>>
>>
>
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.
>
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: URGENT: install sqlite db on Android phone???

2009-07-29 Thread Dianne Hackborn
If there is an application crashed dialog, there WILL be a stack crawl
printed in the logcat output.  Always.

Hmm...  I guess unless Samsung removed this. :p

On Wed, Jul 29, 2009 at 8:01 AM, Christian S.  wrote:

>
> 1. This is the logcat record:
>
> Android Launch!
> adb is running normally.
> Performing com.database.test.v1.Bldatabase activity launch
> Automatic Target Mode: Unable to detect device compatibility. Please
> select a target device.
> Uploading Bldatabase.apk onto device 'I7500OXEy3qBTwH'
> Installing Bldatabase.apk...
> Success!
> Starting activity com.database.test.v1.Bldatabase on device
> ActivityManager: Starting: Intent { comp={com.database.test.v1/
> com.database.test.v1.Bldatabase} }
>
> So the logcat actually shows no errors at all. The screen on the
> device however give this "application has stopped" error. Nothing
> else.
>
> 2. Do you have some sample code that would show a step-by-step
> approach of the way you just described above? (I am a novice that's
> why ...)
> How can I directly make the application look for the database on the
> SD card?
>
> On Jul 29, 4:46 pm, Mark Murphy  wrote:
> > I just tried adb pull on a Google Ion, and you're right -- adb push and
> > pull do not work.
> >
> > Christian S. wrote:
> > > For installing / running the app on the device I only got the usual
> > > error that the application has stopped. This is certainly related to
> > > the missing SQLite database.
> >
> > Out of curiosity, what does the Java stack trace tell you? You can get
> > that via adb logcat, DDMS, or the DDMS perspective in Eclipse.
> >
> > > Any further ideas?
> >
> > Modify your app to check to see if the database exists, and if not, to
> > look for the database on the SD card -- if it finds it, copy the
> > database into the proper spot before using it. That's not terribly
> > secure, but it should work, at least temporarily.
> >
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com|
> http://twitter.com/commonsguy
> >
> > _Android Programming Tutorials_ Version 1.0 Available!
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: URGENT: install sqlite db on Android phone???

2009-07-29 Thread Mark Murphy

Christian S. wrote:
> So the logcat actually shows no errors at all. The screen on the
> device however give this "application has stopped" error. Nothing
> else.

That's odd. Those error dialogs are always supposed to generate Java
stack traces, AFAIK.

> 2. Do you have some sample code that would show a step-by-step
> approach of the way you just described above? (I am a novice that's
> why ...)
> How can I directly make the application look for the database on the
> SD card?

The following is extremely hackish untested psuedoJava, suitable only
for short-term use in emergency situations involving Christians and
Galaxies:

File rootDir=new File(getFilesDir(), "..");
File dbDir=new File(rootDir, "databases");
File db=new File(dbDir, "yourdatabasenamehere");

if (!db.exists()) {
File sdDb=new File(Environment.getExternalStorageDirectory(),
"yourdatabasenamehere");

// insert binary file copy algorithm here, from sdDb to db
}

// open and use your database as normal

where the binary file copy algorithm could be:

http://exampledepot.com/egs/java.io/CopyFile.html

This presumes you put a working copy of your database in
/sdcard/yourdatabasenamehere via DDMS or adb push or mounting the SD
card in your desktop environment or whatever.

This is NOT a great way of doing this sort of thing for production, but
for the purposes of a soonish demo, it just might work.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android 1.5 Programming Books: http://commonsware.com/books.html

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: URGENT: install sqlite db on Android phone???

2009-07-29 Thread Christian S.

1. This is the logcat record:

Android Launch!
adb is running normally.
Performing com.database.test.v1.Bldatabase activity launch
Automatic Target Mode: Unable to detect device compatibility. Please
select a target device.
Uploading Bldatabase.apk onto device 'I7500OXEy3qBTwH'
Installing Bldatabase.apk...
Success!
Starting activity com.database.test.v1.Bldatabase on device
ActivityManager: Starting: Intent { comp={com.database.test.v1/
com.database.test.v1.Bldatabase} }

So the logcat actually shows no errors at all. The screen on the
device however give this "application has stopped" error. Nothing
else.

2. Do you have some sample code that would show a step-by-step
approach of the way you just described above? (I am a novice that's
why ...)
How can I directly make the application look for the database on the
SD card?

On Jul 29, 4:46 pm, Mark Murphy  wrote:
> I just tried adb pull on a Google Ion, and you're right -- adb push and
> pull do not work.
>
> Christian S. wrote:
> > For installing / running the app on the device I only got the usual
> > error that the application has stopped. This is certainly related to
> > the missing SQLite database.
>
> Out of curiosity, what does the Java stack trace tell you? You can get
> that via adb logcat, DDMS, or the DDMS perspective in Eclipse.
>
> > Any further ideas?
>
> Modify your app to check to see if the database exists, and if not, to
> look for the database on the SD card -- if it finds it, copy the
> database into the proper spot before using it. That's not terribly
> secure, but it should work, at least temporarily.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> _Android Programming Tutorials_ Version 1.0 Available!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: URGENT: install sqlite db on Android phone???

2009-07-29 Thread Mark Murphy

I just tried adb pull on a Google Ion, and you're right -- adb push and
pull do not work.

Christian S. wrote:
> For installing / running the app on the device I only got the usual
> error that the application has stopped. This is certainly related to
> the missing SQLite database.

Out of curiosity, what does the Java stack trace tell you? You can get
that via adb logcat, DDMS, or the DDMS perspective in Eclipse.

> Any further ideas?

Modify your app to check to see if the database exists, and if not, to
look for the database on the SD card -- if it finds it, copy the
database into the proper spot before using it. That's not terribly
secure, but it should work, at least temporarily.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 1.0 Available!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: URGENT: install sqlite db on Android phone???

2009-07-29 Thread Christian S.

Mark - I just tried to push it through adb push  onto the device.

I got the following error now: failed to copy 'database.db' to 'data/
data/packagenamehere/databases/database.db': Permission denied

It seems like the folder on the device is write protected and cannot
copy it onto there.

For installing / running the app on the device I only got the usual
error that the application has stopped. This is certainly related to
the missing SQLite database.

Any further ideas?


On Jul 29, 4:02 pm, Mark Murphy  wrote:
> Christian S. wrote:
> > Folks, apologies ... I have a very urgent request. Tomorrow I want to
> > present an Android application on the phone (not on the emulator) to a
> > group of students. I have a Samsung Galaxy running on Android 1.5.
>
> > I got it all hooked up and I can see the device using "adb devices". I
> > can also see it in DDMS. So the connection is fine. I even can install
> > the application on the device - but I cannot run it.
>
> What errors are you getting?
>
> > The main problem seems to be that my application cannot access the
> > corresponding local SQLite database.
>
> Ideally, your application would lazy-create the database.
>
> > I figured out that I also cannot access the data/data folder
> > on the devices.
>
> Not by browsing. Particularly if your application is compiled in debug
> mode, you should be able to access its files and such directly via adb
> push and adb pull. Leastways, last I tried, that worked on devices --
> it's been a bit.
>
> > Then I found out that I
> > have to "root" the device. But absolutely no clue how I can do that.
>
> You should not need to do that.
>
> > Also installing the apk through "adb install " did not work.
>
> What errors did you get? And how did you install the application otherwise?
>
> > What can I do in order to get my SQLite db on the device? Do I have to
> > root it?
>
> If you have an existing SQLite database, with the device plugged in, and
> from the directory where the database resides, run:
>
> adb push your.db /data/data/your.package.here/databases
>
> where your.db is the SQLite database and your.package.here is the Java
> package for your application, as declared in your manifest.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android App Developer Training:http://commonsware.com/training.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: URGENT: install sqlite db on Android phone???

2009-07-29 Thread Mark Murphy

Christian S. wrote:
> Folks, apologies ... I have a very urgent request. Tomorrow I want to
> present an Android application on the phone (not on the emulator) to a
> group of students. I have a Samsung Galaxy running on Android 1.5.
> 
> I got it all hooked up and I can see the device using "adb devices". I
> can also see it in DDMS. So the connection is fine. I even can install
> the application on the device - but I cannot run it.

What errors are you getting?

> The main problem seems to be that my application cannot access the
> corresponding local SQLite database.

Ideally, your application would lazy-create the database.

> I figured out that I also cannot access the data/data folder
> on the devices. 

Not by browsing. Particularly if your application is compiled in debug
mode, you should be able to access its files and such directly via adb
push and adb pull. Leastways, last I tried, that worked on devices --
it's been a bit.

> Then I found out that I
> have to "root" the device. But absolutely no clue how I can do that.

You should not need to do that.

> Also installing the apk through "adb install " did not work.

What errors did you get? And how did you install the application otherwise?

> What can I do in order to get my SQLite db on the device? Do I have to
> root it?

If you have an existing SQLite database, with the device plugged in, and
from the directory where the database resides, run:

adb push your.db /data/data/your.package.here/databases

where your.db is the SQLite database and your.package.here is the Java
package for your application, as declared in your manifest.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android App Developer Training: http://commonsware.com/training.html

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---