Amit
Amit

Reputation: 817

Android app only starts if phone connected to computer using usb cable

I am having strange issue.

I developed android application and deployed to android phone using usb cable.

App starts up only if phone is connected to computer using cable. After starting up, I can disconnect the cable and app still runs fine.

So seems like, for the app to boot up, it requires computer connection.

Any ideas why?

Below is my android manifest.

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
              package="com.test"
              android:installLocation="auto" 
              android:versionName="0.5.14" 
              android:versionCode="33"
              >
      <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19"/>
      <supports-screens android:xlargeScreens="true"
                        android:largeScreens="true"
                        android:normalScreens="true"
                        android:smallScreens="true" />
      <uses-feature android:name="android.hardware.camera.autofocus" />
      <uses-feature android:name="android.hardware.camera.flash" android:required="false" />
      <uses-feature android:name="android.hardware.camera"/>
      <uses-feature android:name="android.hardware.screen.landscape"/>

      <application android:icon="@drawable/bay"
                   android:label="@string/app_name">
        <activity android:name=".CaptureActivity"
                  android:screenOrientation="landscape"
                  android:configChanges="orientation|keyboardHidden|screenSize"
                  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                  android:windowSoftInputMode="stateAlwaysHidden"              
                  >
          <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
            <action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
          </intent-filter>
           <meta-data
               android:name="com.google.android.glass.VoiceTrigger"
               android:resource="@xml/voice_trigger_start" />
          </activity>
        <activity android:name=".HelpActivity"
                  android:screenOrientation="user">
          <intent-filter>
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT"/>
          </intent-filter>
        </activity>

        <activity android:name=".PreferencesActivity" />
      </application>
      <uses-permission android:name="android.permission.CAMERA"/>
      <uses-permission android:name="android.permission.INTERNET"/>
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
      <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
      <uses-permission
         android:name="com.google.android.glass.permission.DEVELOPMENT" />
    </manifest>

Upvotes: 0

Views: 455

Answers (1)

Plinio.Santos
Plinio.Santos

Reputation: 1759

In order to debug the earliest code of our apps, we use to add a call to android.os.Debug.waitForDebugger() which will keep our app waiting for a debugger attach.

There are situations in which we put that call in methods that block the activity's life cycle, such as onCreate(). In these cases, if the device is not connected, android can't attach to a debugger and kepps waiting forever.

So look for that call in your activity life cycle and remove it if found.

Upvotes: 2

Related Questions