[TIMOB-4633] Android: Unable to install pre-populated DB from Android resources
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Needs more info |
Resolution Date | 2017-08-16T01:27:42.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | tbs-1.9.0 |
Reporter | skrabak lukas |
Assignee | Ingo Muschenetz |
Created | 2011-06-24T18:33:00.000+0000 |
Updated | 2017-08-16T01:27:42.000+0000 |
Description
I'm unable to successfully install my prepopulated sqlite database on any android device.
The DB file has over 15.5 mb - it is a dictionary and it has such size for it's contents, which will be doubled in near future.
every time I try to install this DB with Titanium API I get this error.
Even if the app is created only of app.js and file.sqlite and in the app js is nothing more than
Ti.API.info('about to install db');
var db = Titanium.Database.install('newWorld.sqlite', 'newWorld');
Ti.API.info('db is = '+db);
it crashes with this log in console.
06-25 13:34:34.117: DEBUG/AndroidRuntime(3321): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
06-25 13:34:34.117: DEBUG/AndroidRuntime(3321): CheckJNI is ON
06-25 13:34:35.917: DEBUG/AndroidRuntime(3321): --- registering native functions ---
06-25 13:34:43.963: INFO/ActivityManager(60): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=vavra.dominik.japSlovnik/.VavramaturaActivity }
06-25 13:34:44.932: DEBUG/AndroidRuntime(3321): Shutting down VM
06-25 13:34:45.253: INFO/ActivityManager(60): Start proc vavra.dominik.japSlovnik for activity vavra.dominik.japSlovnik/.VavramaturaActivity: pid=3352 uid=10036 gids={1015, 3003}
06-25 13:34:45.597: DEBUG/jdwp(3321): Got wake-up signal, bailing out of select
06-25 13:34:45.597: DEBUG/dalvikvm(3321): Debugger has detached; object registry had 1 entries
06-25 13:34:46.185: DEBUG/dalvikvm(33): GC_EXPLICIT freed 278 objects / 10560 bytes in 872ms
06-25 13:34:47.652: DEBUG/dalvikvm(33): GC_EXPLICIT freed 42 objects / 1856 bytes in 713ms
06-25 13:34:48.356: DEBUG/dalvikvm(33): GC_EXPLICIT freed 2 objects / 64 bytes in 663ms
06-25 13:34:49.520: INFO/TiApplication(3352): (main) [0,0] checkpoint, app created.
06-25 13:34:50.735: INFO/TiApplication(3352): (main) [1269,1269] Titanium 1.7.2 (2011/06/24 15:26 7d536e...)
06-25 13:34:51.508: DEBUG/TiDeployData(3352): (main) [772,2041] Read deploy data: {"debuggerPort":-1,"debuggerEnabled":false,"fastdevPort":57196}
06-25 13:34:52.395: ERROR/TiPlatformHelper(3352): (main) [884,2925] renaming ID
06-25 13:34:54.950: WARN/ActivityManager(60): Launch timeout has expired, giving up wake lock!
06-25 13:34:54.950: INFO/TiRootActivity(3352): (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
06-25 13:34:55.007: INFO/TiApplication(3352): (main) [58,58] Analytics have been disabled
06-25 13:34:56.035: DEBUG/dalvikvm(3352): GC_FOR_MALLOC freed 3715 objects / 344208 bytes in 587ms
06-25 13:34:57.542: ERROR/TiApplication(3352): (main) [2512,2570] APP PROXY: [Ti.App]
06-25 13:34:57.822: DEBUG/TiCommonContactsApi(3352): (main) [282,2852] Using newer contacts api. Android SDK level: 8
06-25 13:34:58.123: WARN/ActivityManager(60): Activity idle timeout for HistoryRecord{44394508 vavra.dominik.japSlovnik/.VavramaturaActivity}
06-25 13:34:59.389: INFO/global(3352): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
06-25 13:34:59.920: DEBUG/dalvikvm(3352): GC_FOR_MALLOC freed 5519 objects / 380272 bytes in 545ms
06-25 13:35:03.220: DEBUG/qemud(38): fdhandler_accept_event: accepting on fd 10
06-25 13:35:03.220: DEBUG/qemud(38): created client 0x19f28 listening on fd 15
06-25 13:35:03.220: DEBUG/qemud(38): client_fd_receive: attempting registration for service 'sensors'
06-25 13:35:03.220: DEBUG/qemud(38): client_fd_receive: -> received channel id 10
06-25 13:35:03.246: DEBUG/qemud(38): client_registration: registration succeeded for client 10
06-25 13:35:03.483: DEBUG/qemud(38): fdhandler_event: disconnect on fd 15
06-25 13:35:03.543: DEBUG/TiFastDev(3352): (kroll$1: app://app.js) [5722,8574] Enabling Fastdev on port 57196
06-25 13:35:03.597: DEBUG/TiFastDev(3352): (kroll$1: app://app.js) [51,8625] sent tokens successfully
06-25 13:35:03.676: DEBUG/TiFastDev(3352): (kroll$1: app://app.js) [23,8648] Fastdev session handshake succesful.
06-25 13:35:03.729: DEBUG/TiFastDev(3352): (kroll$1: app://app.js) [115,8763] sent tokens successfully
06-25 13:35:03.729: DEBUG/KrollContext(3352): (kroll$1: app://app.js) [5,8768] Running evaluated script: file:///android_asset/Resources/app.js
06-25 13:35:04.462: DEBUG/dalvikvm(3352): GC_FOR_MALLOC freed 7127 objects / 493960 bytes in 578ms
06-25 13:35:04.462: INFO/dalvikvm-heap(3352): Forcing collection of SoftReferences for 15074320-byte allocation
06-25 13:35:04.956: DEBUG/dalvikvm(3352): GC_FOR_MALLOC freed 767 objects / 33192 bytes in 441ms
06-25 13:35:04.956: ERROR/dalvikvm-heap(3352): Out of memory on a 15074320-byte allocation.
06-25 13:35:04.956: INFO/dalvikvm(3352): "kroll$1: app://app.js" prio=5 tid=8 RUNNABLE
06-25 13:35:05.009: INFO/dalvikvm(3352): | group="main" sCount=0 dsCount=0 s=N obj=0x442ac348 self=0x29e590
06-25 13:35:05.009: INFO/dalvikvm(3352): | sysTid=3384 nice=0 sched=0/0 cgrp=default handle=2746064
06-25 13:35:05.009: INFO/dalvikvm(3352): | schedstat=( 2296899096 3725402118 149 )
06-25 13:35:05.009: INFO/dalvikvm(3352): at org.appcelerator.titanium.TiFastDev$Session.readToken(TiFastDev.java:~240)
06-25 13:35:05.035: INFO/dalvikvm(3352): at org.appcelerator.titanium.TiFastDev$Session.readMessage(TiFastDev.java:298)
06-25 13:35:05.035: INFO/dalvikvm(3352): at org.appcelerator.titanium.TiFastDev$Session.sendMessage(TiFastDev.java:367)
06-25 13:35:05.035: INFO/dalvikvm(3352): at org.appcelerator.titanium.TiFastDev.openInputStream(TiFastDev.java:140)
06-25 13:35:05.076: INFO/dalvikvm(3352): at org.appcelerator.titanium.io.TiResourceFile.getInputStream(TiResourceFile.java:65)
06-25 13:35:05.147: INFO/dalvikvm(3352): at ti.modules.titanium.database.DatabaseModule.install(DatabaseModule.java:115)
06-25 13:35:05.147: INFO/dalvikvm(3352): at ti.modules.titanium.database.DatabaseModuleBindingGen$1.invoke(DatabaseModuleBindingGen.java:114)
06-25 13:35:05.147: INFO/dalvikvm(3352): at org.appcelerator.kroll.KrollMethod.call(KrollMethod.java:51)
06-25 13:35:05.199: INFO/dalvikvm(3352): at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1701)
06-25 13:35:05.227: INFO/dalvikvm(3352): at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:854)
06-25 13:35:05.253: INFO/dalvikvm(3352): at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
06-25 13:35:05.253: INFO/dalvikvm(3352): at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
06-25 13:35:05.286: INFO/dalvikvm(3352): at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3177)
06-25 13:35:05.286: INFO/dalvikvm(3352): at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
06-25 13:35:05.286: INFO/dalvikvm(3352): at org.mozilla.javascript.Context.evaluateReader(Context.java:1142)
06-25 13:35:05.286: INFO/dalvikvm(3352): at org.appcelerator.titanium.kroll.KrollContext$DefaultEvaluator.evaluateFile(KrollContext.java:105)
06-25 13:35:05.312: INFO/dalvikvm(3352): at org.appcelerator.titanium.kroll.KrollContext.evaluateScript(KrollContext.java:306)
06-25 13:35:05.364: INFO/dalvikvm(3352): at org.appcelerator.titanium.kroll.KrollContext.handleEvalFile(KrollContext.java:318)
06-25 13:35:05.422: INFO/dalvikvm(3352): at org.appcelerator.titanium.kroll.KrollContext.handleMessage(KrollContext.java:217)
06-25 13:35:05.422: INFO/dalvikvm(3352): at org.appcelerator.titanium.TiMessageQueue.handleMessage(TiMessageQueue.java:223)
06-25 13:35:05.422: INFO/dalvikvm(3352): at android.os.Handler.dispatchMessage(Handler.java:95)
06-25 13:35:05.448: INFO/dalvikvm(3352): at android.os.Looper.loop(Looper.java:123)
06-25 13:35:05.448: INFO/dalvikvm(3352): at org.appcelerator.titanium.kroll.KrollHandlerThread.run(KrollHandlerThread.java:86)
06-25 13:35:05.474: WARN/dalvikvm(3352): threadid=8: thread exiting with uncaught exception (group=0x4001d800)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): (kroll$1: app://app.js) [1756,10557] Sending event: exception on thread: kroll$1: app://app.js msg:java.lang.OutOfMemoryError; Titanium 1.7.2,2011/06/24 15:26,7d536e...
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): java.lang.OutOfMemoryError
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.appcelerator.titanium.TiFastDev$Session.readToken(TiFastDev.java:240)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.appcelerator.titanium.TiFastDev$Session.readMessage(TiFastDev.java:298)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.appcelerator.titanium.TiFastDev$Session.sendMessage(TiFastDev.java:367)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.appcelerator.titanium.TiFastDev.openInputStream(TiFastDev.java:140)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.appcelerator.titanium.io.TiResourceFile.getInputStream(TiResourceFile.java:65)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at ti.modules.titanium.database.DatabaseModule.install(DatabaseModule.java:115)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at ti.modules.titanium.database.DatabaseModuleBindingGen$1.invoke(DatabaseModuleBindingGen.java:114)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.appcelerator.kroll.KrollMethod.call(KrollMethod.java:51)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1701)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:854)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3177)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.mozilla.javascript.Context.evaluateReader(Context.java:1142)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.appcelerator.titanium.kroll.KrollContext$DefaultEvaluator.evaluateFile(KrollContext.java:105)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.appcelerator.titanium.kroll.KrollContext.evaluateScript(KrollContext.java:306)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.appcelerator.titanium.kroll.KrollContext.handleEvalFile(KrollContext.java:318)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.appcelerator.titanium.kroll.KrollContext.handleMessage(KrollContext.java:217)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.appcelerator.titanium.TiMessageQueue.handleMessage(TiMessageQueue.java:223)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at android.os.Handler.dispatchMessage(Handler.java:95)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at android.os.Looper.loop(Looper.java:123)
06-25 13:35:05.586: ERROR/TiUncaughtHandler(3352): at org.appcelerator.titanium.kroll.KrollHandlerThread.run(KrollHandlerThread.java:86)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): FATAL EXCEPTION: kroll$1: app://app.js
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): java.lang.OutOfMemoryError
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.appcelerator.titanium.TiFastDev$Session.readToken(TiFastDev.java:240)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.appcelerator.titanium.TiFastDev$Session.readMessage(TiFastDev.java:298)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.appcelerator.titanium.TiFastDev$Session.sendMessage(TiFastDev.java:367)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.appcelerator.titanium.TiFastDev.openInputStream(TiFastDev.java:140)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.appcelerator.titanium.io.TiResourceFile.getInputStream(TiResourceFile.java:65)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at ti.modules.titanium.database.DatabaseModule.install(DatabaseModule.java:115)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at ti.modules.titanium.database.DatabaseModuleBindingGen$1.invoke(DatabaseModuleBindingGen.java:114)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.appcelerator.kroll.KrollMethod.call(KrollMethod.java:51)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1701)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:854)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3177)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.mozilla.javascript.Context.evaluateReader(Context.java:1142)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.appcelerator.titanium.kroll.KrollContext$DefaultEvaluator.evaluateFile(KrollContext.java:105)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.appcelerator.titanium.kroll.KrollContext.evaluateScript(KrollContext.java:306)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.appcelerator.titanium.kroll.KrollContext.handleEvalFile(KrollContext.java:318)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.appcelerator.titanium.kroll.KrollContext.handleMessage(KrollContext.java:217)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.appcelerator.titanium.TiMessageQueue.handleMessage(TiMessageQueue.java:223)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at android.os.Handler.dispatchMessage(Handler.java:95)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at android.os.Looper.loop(Looper.java:123)
06-25 13:35:05.848: ERROR/AndroidRuntime(3352): at org.appcelerator.titanium.kroll.KrollHandlerThread.run(KrollHandlerThread.java:86)
06-25 13:35:06.262: WARN/ActivityManager(60): Force finishing activity vavra.dominik.japSlovnik/.VavramaturaActivity
06-25 13:35:06.919: WARN/ActivityManager(60): Activity pause timeout for HistoryRecord{44394508 vavra.dominik.japSlovnik/.VavramaturaActivity}
06-25 13:35:08.206: DEBUG/dalvikvm(122): GC_EXPLICIT freed 143 objects / 7416 bytes in 3067ms
06-25 13:35:19.548: WARN/ActivityManager(60): Activity destroy timeout for HistoryRecord{44394508 vavra.dominik.japSlovnik/.VavramaturaActivity}
06-25 13:36:02.250: DEBUG/SntpClient(60): request time failed: java.net.SocketException: Address family not supported by protocol
06-25 13:37:26.356: INFO/Process(3352): Sending signal. PID: 3352 SIG: 9
06-25 13:37:26.687: WARN/InputManagerService(60): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@4433f418
But it does not happen if the Database is like 120kb of size, is there any way to get this fixed anytime soon ?
Or at least install bigger files to SDcard and open that file ?
Edit1: sorry for the typo in code it was really .install() but as I've posted this really late yesterday (or today dunno what time it was) I've simply misspelled the word.
Note that there is an error in your code - you have used an
instal
rather thaninstall
method. Please would you post the Titanium SDK build date and hash, shown in the console before the app launches? To determine whetherinstall()
oropen()
is failing, would you run onlyTi.Database.install('file.sqlite','database')
and then browse the device usingddms / Device / File Explorer
to determine whether the db file has been copied todata/data/your_device_id/
or one of its subdirectories (ie the databases dir)? CheersHi, sorry for misspelling the word, as it is said in Edit, it was really late.
I've tried only the install method and I've got something new in my console output. So here is the corresponding app.js code
and here is the console output
look over here, I believe this line was not here before as seen here in original output before I've downloaded new SDK (?) http://pastie.org/2117289
Ok second try with
app.js
console (DDMS) output
Once again I've got this memory allocation problem & force close app
May be related to TIMOB-4612 and TIMOB-4632
Problem
Pre-populated Database on Android is not defined as it was installed incorrectly.Target Environment
+ **Product**: Mobile + **Titanium SDK**: Mobile 1.7.1 + **Platform OS**: Android + **Platform OS Version**: 2.2 and upConsole Output
{noformat} I/TiAPI ( 7064): (kroll$1: app://app.js) [855,3225] ***************************** I/TiAPI ( 7064): (kroll$1: app://app.js) [2,3227] Innan jag forsöker hämta musik-filen på 4 Mb: D/dalvikvm( 7064): GC_FOR_MALLOC freed 5184 objects / 402072 bytes in 159ms I/dalvikvm-heap( 7064): Grow heap (frag case) to 6.996MB for 4021394-byte allocation D/dalvikvm( 7064): GC_FOR_MALLOC freed 54 objects / 2272 bytes in 108ms W/ActivityManager( 60): Launch timeout has expired, giving up wake lock! W/ActivityManager( 60): Activity idle timeout for HistoryRecord{43fa2538 se.dunso.malmofestivulen/.MffActivity} {noformat}Associated HD ticket
An ENT customer relies on this, http://appc.me/c/APP-391353Reassigning tickets, as per Tony Guntharp's request
It would be helpful if a sample DB file is provided.
Closing.