I develop an Android app for my pcDuino board. There is Android 4.2 version on it.
In AndroidManifest.xml, I have my service:
<service
android:name="com.compagny.myapp.service.HTTPService"
android:enabled="true" >
<!-- To allow start the Android service (for debugging session) -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</service>
I want to debug it, so I added this filter.
From my laptop, I can deploy in debug and release version my application, but when I want to start my app in release mode, it doesn't work. I can see the service into application manager from my pcDuino board, but nothing happens (even traces in Logcat!).
I start my service from a command line:
am startservice -n com.compagny.myapp/com.compagny.myapp.service.HTTPService
Related
I have a large / fairly complex Flutter application we've been writing for a few months. Soo -- we've been running against the simulator etc and on real-devices with flutter run (via usb cable) on various Android devices without issue ..
However, to publish we obviously have to create a APK package etc. This is where it gets odd --
A "flutter install" of the same build that "flutter run" works fine does not show any artifacts on the device, either emulator or physical. There is no Icon that shows up (our custom one) - - no app shows in the "App List" .. However, in the Settings -> Apps one DOES see our application listed .. but it doesn't do anything when tapped ...
We're sort of wits end here -- oh, and everything works just fine w/ iOS .. we can publish with TestFlight no problems.. so the issue is pure Android ..
We are pretty sure it must be something to do with the the Manifest.xml file .. but we've been looking at it and looking at it and nothing is popping out that, to us, explains this behavior. Why does "flutter run" work and "flutter install" does not?
And it's not just my environment -- any of the other 3 programmers have the exact same issue / problem .. and "flutter doctor -v" is all green and again, "flutter run" works as expected (i.e. the app is installed and launched and runs) ..
Has anyone seen this? Any ideas on how to debug what Android isn't liking in the package? We're sort of newbie Android developers with just know enough knowledge to be dangerous :)
TIA!
OK -- so here is the actual answer -- the problem WAS the Manifest .. I had the intent-filter section rather wrong when I added deep-links and created an "impossible" intent that couldn't be ever satisfied.
Old Manifest.xml intent:
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<!-- Deep Links -->
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="missionmode4" />
</intent-filter>
The intent-filter is AND logic .. creating an impossible Intent .. the new and working version is:
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Deep Links -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="missionmode4" />
</intent-filter>
That creates two separate intent filters .. one for the launcher and then one for the deep links as desired.
Voila!
I have a weird situation occurring right now.
Two cases
Emulator running - react-native run-android gets installed as an application on the emulator in debug mode and is visible in the application list screen.
Real device running - react-native run-android gets installed on the device, but I can't see the installed application on the application list screen. So, to open the app again, I need to run the command react-native run-android again. When I disconnect the device, an alert pops up, giving a message similar to Application XYZ process stopped (I don't remember the exact message)
Is there any additional settings that need to be done in order to see it as installed?
Use case - I have a deep link arriving on an sms. Need to open an app for the same, but it opens the same in the web browser (I have my deep link scheme in the manifest file).
My current conclusion - Since, the app is not visible as installed, maybe that's why the intent is not getting recognized as a deep link.
<application
android:name=".MainApplication"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:allowBackup="false"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<data
android:host="xyz.com"
android:pathPrefix="/"
android:scheme="https" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
Any thoughts?
Note - Using RN 0.56.
I'm following this guide to use com.android.future.usb library on API 10.
I've done the following:
Installed Google APIs 10 from SDK Manager:
Chose Google APIs 10 as my Project Build Target:
Added these to manifest:
<uses-feature android:name="android.hardware.usb.accessory" />
(direct child of <manifest>)
<uses-library android:name="com.android.future.usb.accessory" />
(child of <application>)
<meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="#xml/accessory_filter" />
(child of first activity)
Created res/xml/accessory_filter.xml as mentioned here.
Doing this allowed me to use com.android.future.usb and its sub classes. But the problem is the application won't start after the changes in manifest.
This is a rooted device, and this application is configured by the OS to start automatically on device startup.
Should I do any other configurations to make this work? Maybe something should be done in the firmware?
edit:
Here's logcat with everything relating to usb:
USB mass storage support is not enabled in the kernerl
usb_configuration switch is not enabled in the kernerl
Volume usb state changing -1 (Initializing) -> 0 (No-Media)
Ignoring unknown switch 'usb_connected'
Package com.example.gui requires unavailable shared library com.android.future.usb.accessory: failing!
Skipping unknown volume '/mnt/usb'
USB Service
This kernel does not have USB configuration switch support
It's not clear what you mean by the application won't start.
If you are expecting the application to start automatically on device startup. This has the instructions for doing that: How to start an Application on startup?
If the problem is the application will not compile, more information on the error encountered will be needed.
You mention that you made changes to the manifest per the link you provided. That example also includes an intent-filter tag to the activity element in the manifest, which you did not mention. So the activity element in the manifest would have two intent-filters:
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="#xml/accessory_filter" />
</activity>
So, your application not starting might be because you removed the MAIN / LAUNCHER intent filter from your activity manifest?
Normally when I run or debugg my application, it unistalls the old version, installs new version and finally it runs the new application, same process when I debug. Some days ago my eclipse started to work in a different way, it installs my application but it does not get ran. Before intalling I get this LogCat:
No Launcher activity found!
The launch will only sync the application package on the device!
Here my Manifest:
<activity
android:name="com.company.app.activities.WelcomeActivity"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Can anybody help me with this? If I want to run the applications it's not a problem because I just have to do it manually but I can not debug.
Remove the follwing line from your manifest and try ,
<action android:name="android.intent.action.VIEW" />
I tried installing my android application on an Android-powered phone. And I know that, as the APK is being installed in the device, automatically it creates a folder of that application. But my application doesn't create a folder, anyone who has an idea on how I resolve this?
If you by folder mean launcer icon to start the app from...
Have you added
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
to one of your activities in the manifest file?