Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15246] App won't start if uses-sdk is specified

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionCannot Reproduce
Resolution Date2016-08-18T22:00:28.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, minSdkVersion, use-sdk
ReporterOsama Abbas
AssigneeEric Merriman
Created2013-06-16T15:43:08.000+0000
Updated2017-03-24T21:56:30.000+0000

Description

*Steps to reproduce* 1. create default app (not alloy). 2. Run it in Android Emulator, It will run without issues. 3. Now change tiapp.xml and add this snippet instead of default :
<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="17"/>
    </manifest>
</android>
4. Running emulator will produce 'Unfortunately, APP has stopped.'

Comments

  1. Daniel Sefton 2013-06-18

    With 3.1 GA and below, and a minSdkVersion of 11 and above (10 and below works fine) throws an SDK error at build time. However, after I switched to 3.1.1 GA it worked. Please try with the latest SDK and Studio released today. In no case did I get a runtime crash.
  2. Lluis Gerard 2013-08-03

    I'm using 3.1.1 GA and copying this manifest here I still get the error. I think it has to do with this "android.os.NetworkOnMainThreadException" because Appcelerator must be accesing to the network using the main thread and in some sdk versions this is not allowed.
  3. Daniel Sefton 2013-08-05

    Please can you provide: - The last few lines of log output where you get 'Unfortunately, APP has stopped.' - Your Studio log file (Help -> Studio -> Clear log file, Reproduce issue, Help -> Studio -> View log file) - Your diagnostic (Help -> Studio -> Run Diagnostic Test...) And can you clarify where you get this "android.os.NetworkOnMainThreadException"? Thanks.
  4. Lluis Gerard 2013-08-06

    Trying to paste here but get all the time: {noformat} The JIRA server could not be contacted. This may be a temporary glitch or the server may be down. Close this dialog and press refresh in your browser {noformat}
  5. Lluis Gerard 2013-08-06

    This only happens when I copy exactly the example here (min:11, target: 17), if I use (min:8, target 9) I get no alert and everything works ok. **The last few lines of log output where you get 'Unfortunately, APP has stopped.** (I removed the name of my app by XXXX becuase of the NDA I signed): This is where you can see "android.os.NetworkOnMainThreadException" but don't know if it really has anything to do with this bug. {noformat} D/TiAssetHelper( 997): Fetching "app.js" with Fastdev... D/AndroidRuntime( 997): Shutting down VM W/dalvikvm( 997): threadid=1: thread exiting with uncaught exception (group=0x40a71930) E/TiApplication( 997): (main) [361,1124] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.XXXXXX.XXXXXX/com.XXXXX.XXXXXXX.XXXXXXXXXActivity}: android.os.NetworkOnMainThreadException; Titanium 3.1.1,2013/06/15 16:10,f7592c1 E/TiApplication( 997): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.XXXXX.XXXXXXX/com.XXXXX.XXXXXXX.XXXXXXXXXActivity}: android.os.NetworkOnMainThreadException E/TiApplication( 997): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) E/TiApplication( 997): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) E/TiApplication( 997): at android.app.ActivityThread.access$600(ActivityThread.java:141) E/TiApplication( 997): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) E/TiApplication( 997): at android.os.Handler.dispatchMessage(Handler.java:99) E/TiApplication( 997): at android.os.Looper.loop(Looper.java:137) E/TiApplication( 997): at android.app.ActivityThread.main(ActivityThread.java:5041) E/TiApplication( 997): at java.lang.reflect.Method.invokeNative(Native Method) E/TiApplication( 997): at java.lang.reflect.Method.invoke(Method.java:511) E/TiApplication( 997): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) E/TiApplication( 997): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) E/TiApplication( 997): at dalvik.system.NativeStart.main(Native Method) E/TiApplication( 997): Caused by: android.os.NetworkOnMainThreadException E/TiApplication( 997): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117) E/TiApplication( 997): at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:163) E/TiApplication( 997): at libcore.io.IoBridge.recvfrom(IoBridge.java:513) E/TiApplication( 997): at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488) E/TiApplication( 997): at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46) E/TiApplication( 997): at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240) E/TiApplication( 997): at org.appcelerator.kroll.common.TiFastDev$Session.blockRead(TiFastDev.java:310) E/TiApplication( 997): at org.appcelerator.kroll.common.TiFastDev$Session.readInt(TiFastDev.java:349) E/TiApplication( 997): at org.appcelerator.kroll.common.TiFastDev$Session.readTokenCount(TiFastDev.java:412) E/TiApplication( 997): at org.appcelerator.kroll.common.TiFastDev.openInputStream(TiFastDev.java:214) E/TiApplication( 997): at org.appcelerator.kroll.util.KrollAssetHelper.readAsset(KrollAssetHelper.java:53) E/TiApplication( 997): at org.appcelerator.titanium.TiLaunchActivity.loadActivityScript(TiLaunchActivity.java:103) E/TiApplication( 997): at org.appcelerator.titanium.TiLaunchActivity.windowCreated(TiLaunchActivity.java:151) E/TiApplication( 997): at org.appcelerator.titanium.TiRootActivity.windowCreated(TiRootActivity.java:109) E/TiApplication( 997): at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:527) E/TiApplication( 997): at org.appcelerator.titanium.TiLaunchActivity.onCreate(TiLaunchActivity.java:144) E/TiApplication( 997): at org.appcelerator.titanium.TiRootActivity.onCreate(TiRootActivity.java:97) E/TiApplication( 997): at android.app.Activity.performCreate(Activity.java:5104) E/TiApplication( 997): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) E/TiApplication( 997): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) E/TiApplication( 997): ... 11 more D/dalvikvm( 997): GC_CONCURRENT freed 396K, 15% free 3246K/3776K, paused 6ms+38ms, total 149ms E/AndroidRuntime( 997): FATAL EXCEPTION: main E/AndroidRuntime( 997): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.XXXXX.XXXXXXX/com.XXXXX.XXXXXXXActivity}: android.os.NetworkOnMainThreadException E/AndroidRuntime( 997): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) E/AndroidRuntime( 997): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) E/AndroidRuntime( 997): at android.app.ActivityThread.access$600(ActivityThread.java:141) E/AndroidRuntime( 997): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) E/AndroidRuntime( 997): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime( 997): at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime( 997): at android.app.ActivityThread.main(ActivityThread.java:5041) E/AndroidRuntime( 997): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 997): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime( 997): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) E/AndroidRuntime( 997): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) E/AndroidRuntime( 997): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime( 997): Caused by: android.os.NetworkOnMainThreadException E/AndroidRuntime( 997): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117) E/AndroidRuntime( 997): at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:163) E/AndroidRuntime( 997): at libcore.io.IoBridge.recvfrom(IoBridge.java:513) E/AndroidRuntime( 997): at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488) E/AndroidRuntime( 997): at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46) E/AndroidRuntime( 997): at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240) E/AndroidRuntime( 997): at org.appcelerator.kroll.common.TiFastDev$Session.blockRead(TiFastDev.java:310) E/AndroidRuntime( 997): at org.appcelerator.kroll.common.TiFastDev$Session.readInt(TiFastDev.java:349) E/AndroidRuntime( 997): at org.appcelerator.kroll.common.TiFastDev$Session.readTokenCount(TiFastDev.java:412) E/AndroidRuntime( 997): at org.appcelerator.kroll.common.TiFastDev.openInputStream(TiFastDev.java:214) E/AndroidRuntime( 997): at org.appcelerator.kroll.util.KrollAssetHelper.readAsset(KrollAssetHelper.java:53) E/AndroidRuntime( 997): at org.appcelerator.titanium.TiLaunchActivity.loadActivityScript(TiLaunchActivity.java:103) E/AndroidRuntime( 997): at org.appcelerator.titanium.TiLaunchActivity.windowCreated(TiLaunchActivity.java:151) E/AndroidRuntime( 997): at org.appcelerator.titanium.TiRootActivity.windowCreated(TiRootActivity.java:109) E/AndroidRuntime( 997): at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:527) E/AndroidRuntime( 997): at org.appcelerator.titanium.TiLaunchActivity.onCreate(TiLaunchActivity.java:144) E/AndroidRuntime( 997): at org.appcelerator.titanium.TiRootActivity.onCreate(TiRootActivity.java:97) E/AndroidRuntime( 997): at android.app.Activity.performCreate(Activity.java:5104) E/AndroidRuntime( 997): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) E/AndroidRuntime( 997): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) E/AndroidRuntime( 997): ... 11 more {noformat}
  6. Lluis Gerard 2013-08-06

    **Your Studio log file (Help -> Studio -> Clear log file, Reproduce issue, Help -> Studio -> View log file):** When I do this, I only get a blank log file :O **Your diagnostic (Help -> Studio -> Run Diagnostic Test...)** I tried different ways to paste it here and I always get a JIRA Server error. {noformat} Host OS: Mac OS X OS Version: 10.8.4 OS Arch: x86 JRE Version: 1.6.0_51 JRE Vendor: Apple Inc. JRE Home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home Titanium Studio Version: 3.1.1.201306112235 Install Directory: file:/Applications/Titanium Studio/ Workspace Directory: file:/Users/lluisgerard/Titanium/ VM Arguments: -Xms40m -Xmx1024m -Declipse.p2.unsignedPolicy=allow -Declipse.log.size.max=10000 -Declipse.log.backup.max=5 -Xdock:icon=../Resources/titanium.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -XX:MaxPermSize=256m -Djava.class.path=/Applications/Titanium Studio/TitaniumStudio.app/Contents/MacOS//../../../plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar Language: en_US {noformat}
  7. Lluis Gerard 2013-08-06

    Adding false doesn't make a difference... but maybe this is network related and not that the App just doesn't start.
  8. Chris Barber 2016-08-18

    Unable to reproduce using Titanium SDK 6.
  9. Lee Morris 2017-03-24

    Closing ticket as the issue cannot be reproduced.

JSON Source