Will android app crash if manifest use class not defined? - android

If we need to use a service say tvinputservice in Manifest but the service is available with android.software.live_tv. If a device doesn't have android.software.live_tv and we put tvinputservice in Manifest. Will the app crash on that device?

That will not allow to install the app on such devices (without the feature) through Google Play. That does not prevent you from installing the apk manually on such devices though, and the app will not crash until it actually try to use the functionality which is not present.
To allow installing the app on such devices via Google Play, you can use android:required="false" inside uses-feature tag.

You can choose Min SDk and Max SDK in Gradle file in Android Studio
and Manifest in Eclipse .
Min SDK and Max SDK is configure that your application run on which devices.

Related

Can't install my app on wear

I tried to add a wear module to my existing app, tried a lot of solutions, but can't figure out why my app is not being installed on my watch.
What I tried :
First, Manual packaging with my app : https://developer.android.com/training/wearables/apps/packaging.html
But I quickly decided not to go through this.
Then I decided to go to gradle include, so to the build.gradle of app, I added the following to the end of dependencies :
debugWearApp project(path:':wear', configuration: 'flavor1Debug')
releaseWearApp project(path:':wear', configuration: 'flavor1Release')
To the build.gradle of wear, I added the following to the beginning of dependencies :
wearApp project(':wear')
Then, in android{} section of wear build.gradle, just after buildToolsVersion, I added the following :
publishNonDefault true
What I have seen :
No problem to install the wear app to the wear using bluetooth debug of the wear
Then, when I install a generate a release version of my app, I can see in raw, that it has been added a file android_wear_micro_apk.apk to res/raw which is my watch app.
I also saw a file android_wear_micro_apk.xml in res/xml with, from what I guess between hexa codes, the description of wear app.
Then I compare signatures :
keytool -list -printcert -jarfile mobile_app.apk
keytool -list -printcert -jarfile wear_app.apk
Using the wear app generated in res/raw. They exactly have the same signature. Then I compared :
aapt dump badging mobile_app.apk
aapt dump badging wear_app.apk
They have exact same package names and version codes and names.
So, from that :
Apk of wear is correctly added
Apk of wear is working if installed on the wear using adb and bluetooth debug
Both apk have same version code, version name, and package name
Wear is not requiring any permission
Phone is requesting following permissions
android.permission.ACCESS_NETWORK_STATE
android.permission.INTERNET
com.android.vending.BILLING
com.google.android.c2dm.permission.RECEIVE
android.permission.VIBRATE
android.permission.WRITE_EXTERNAL_STORAGE
android.permission.BLUETOOTH
android.permission.BLUETOOTH_ADMIN
com.samsung.accessory.permission.ACCESSORY_FRAMEWORK
com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY
com.samsung.WATCH_APP_TYPE.Companion
com.samsung.wmanager.ENABLE_NOTIFICATION
I'm really wondering what I could have forgotten.
Thanks for any help
According to one of Google’s Android Developer Advocates, Android Wear 2.0 will require completely standalone watch and phone apps, and abandons the system used since the first version of Android Wear that automatically installs Android Wear apps based on the apps you have on your phone.
He puts it plainly in reply to another developer in the Android Wear Developers Google+ community (emphasis ours):
A Wear 2.0 user must visit the Play Store on their watch to install
apps. There is no auto-install like on Wear 1.X. Wear 2.0 apps get
full network access and can be installed completely separately from
the handheld app so the focus is much more on standalone Wear apps
than the handheld centric 1.X Wear apps.
But what about apps built solely for your watch? Well, there's a whole
store worth of apps that go beyond simple notifications and live on
the watch itself. Rather oddly, these still have to be installed
through your smartphone. For now, at least - the new Android Wear 2.0
update will include functionality for standalone apps.
Forum
On the watch:
Settings, Un-pair with phone. (Old release of AW may say Factory
reset.)
Do not set up the watch yet.
On the phone:
In Android Wear use the Disconnect... option.
In Android Wear, use Settings, Device settings and touch the watch
name, Touch FORGET WATCH.
Settings, Bluetooth. If you still see the watch, touch Forget... the
watch so it no longer appears in the list of paired devices.
Settings, Device, Apps, select Google Play Services. Clear cache and
Clear data. Uninstall updates.
Settings, Device, Apps, select Google App. Clear cache and Clear
data. Also Uninstall updates.
Settings, Device, Apps, select Android Wear. Clear cache and Clear
data. Also Uninstall updates.
Play Store, Apps, My apps, touch the Update all button.
You may want to check permissions declared in your app. As mentioned in Requesting Permissions on Android Wear regarding mismatching permission models between wearable and handset app,
If your handset app begins using the Android 6.0 (API level 23) model but your wearable app does not, the system downloads the Wear app, but does not install it. The first time the user launches the app, the system prompts them to grant all pending permissions. Once they do so, it installs the app. If your app, for example a watch face, does not have a launcher, the system displays a stream notification asking the user to grant the permissions the app needs.
The suggested solutions in these SO posts might also help:
Android Wear App not installed
Android Wear app not installing through handset

Android wear packaging 1 compatible device

I had an app uploaded in google play, but now I have done a update with Android Wear. I have my project in Android Studio with the mobile and the wear APK in the same project and with the same package. It runs perfectly in debug mode. I can export the new update of my app with the Android Wear app embebed, but when I upload it with the Google developer console shows that there are only one compatible device.
Attached Images:
How can i make my wear app to be compatible with more than 1 device? :-)
You shouldn't have the permission android.hardware.type.WATCH in the Play Store permissions.
This is only required for the wear application.
Remove it from your AndroidManifest.xml mobile application, it looks like:
<uses-feature android:name="android.hardware.type.watch" />

"No, missing feature: WATCH" when I try to run my smartphone app with wear app?

I have a smartphone app with a wear app that has been packaged inside of it, similar to the first two steps of this section:
https://developer.android.com/training/wearables/apps/packaging.html#Studio
I was originally told that my smartphone wasn't running an SDK large enough to support the app (my phone was using KitKat, apparently I needed API 20), so now I am using my Nexus 7 with Android L preview, and this problem has appeared:
I have a smartwatch emulator and tablet running, and both are connected using the adb -d forward tcp:5601 tcp:5601 trick, so I have no idea how to fix this now!
How can I get the smartphone app to run and automatically allow the wear app to install onto the emulator?
Please look at this!
May be you should select the APP item before you launch your app.
In your project you have two applications:
Mobile
Wearable
Mobile app should be installed on mobile device (phone/tablet) and Wearable app should be installed on Android Wear device.
This message No, missing feature: WATCH means that you're trying to install Wearable app on mobile phone - you shouldn't do that, your mobile device is not a WATCH. So once again: just launch Mobile app on mobile and Wearable app on Android Wear.
I was originally told that my smartphone wasn't running an SDK large
enough to support the app (my phone was using KitKat, apparently I
needed API 20), so now I am using my Nexus 7 with Android L preview,
and this problem has appeared:
Only the Wearable app should require API level 20, but Mobile app can target any other SDK level (like 10, 14 etc.). You don't need to set higher SDK level for Mobile app only because it supports Wearable app.
How can I get the smartphone app to run and automatically allow the
wear app to install onto the emulator?
As described in the tutorial that you've linked:
If packaged properly, when users download the handheld app, the
system automatically pushes the wearable app to the paired wearable.
But please read the note at the top of this page:
Note: This feature doesn't work when you are signing your apps with a
debug key when developing. While developing, installing apps with adb
install or Android Studio directly to the wearable is required.
This means that automatically installing Wearable app after installing Mobile app (with Wearable app packaged inside) will only work after signing app with your publishing certificate (and not with the debug one - as is done during standard application Launch from Android Studio/Eclipse).
I had the same error when I tried running non wearable application on my device and the error was due to some Android Studio issue with misreading the uses-feature attribute in the Manifest (it reads required false as true):
<uses-feature
android:name="android.hardware.type.watch"
android:required="false"/>
If you remove it from the manifest the error will disappear. I think that it should be already fixed in Android Studio 1.4.1 or 1.5.
Check if you have not open any other android project. I also faced same issue which got solved after I closed android project which has target API greater than watch's.

How can I deploy my Eclipse builds to Google Glass after updating to XE16

My Google Glass just automatically installed the latest update (XE16). After rebooting the device it turned out that all my previous deployments are removed from the device and I am not able to install my previous projects anymore.
My targetSdkVersion is set to '19' so therefore I should be able to support the latest firmware (kitkat).
What do I need to do to re-enable the deployment of builds via Eclipse?
I tried updating all of the Android tools via Software manager and confirmed that all libraries from API level 19 are installed. Odd thing is that the console gives the exact same information before the update (\MyProjectFolder\MyProject.apk installed on device, Done!)
Found the issue, we now need to add another permission to the manifest to enable deployment.
In Manifest add
<uses-permission android:name="com.google.android.glass.permission.DEVELOPMENT"/>
Link from Google

satisfying app dependency on Google Maps api

I'm developing an app that uses the Google Maps api to give you a list of a given business type at runtime based on your current location.
I developed this on Eclipse using my LG Ally running Android 2.2.2 as a test device.
The QA team is not local to me so I emailed them the same apk file I installed on my phone.
Here's where it gets strange.
One tester, was able to install the app and run it with no problems. That person is using a phone running Android 2.2.2 - just like I am, although I am unsure if their phone is an LG Ally.
The other person is using a phone running 2.3.3 and they are unable to run the app. They've installed an app that emails me the logcat output and the only message that looks even vaguely related is:
06-21 14:22:57.147 W/PackageInstaller( 8784): Parse error when parsing manifest. Discontinuing installation
I've read on Stackoverflow that the manifest must contain info about the sdk. My Android Manifest contains:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/>
I've also read on Stackoverflow that some people have problems installing apps emailed to them and suggested something like DropBox.
I've done both (included the above sdk line in my Manifest and delivered the app via DropBox) and they are still unable to run the app.
Which got me wondering about the Google Maps dependency. I'm not delivering the maps.jar file in my apk. Is there a way I can check that the maps.jar is available on the device where my app is running? Is there a way I can deliver the maps.jar file? What do I do if maps.jar is already present?
Is there a way I can check that the maps.jar is available on the device where my app is running?
If you have <uses-library> with the android:required="false" attribute, then your app can run even if the device lacks the Google Maps add-on for Android. You would use Class.forName() to see if MapActivity exists before trying to actually use a MapActivity, as in this sample project.
However, if your <uses-library> lacks an android:required attribute, or has it set to true, then the app simply cannot be installed on the device.
Is there a way I can deliver the maps.jar file?
Only in the form of buying the user another device -- one that has the Google Maps add-on -- and shipping it to them. Either the device has it (as do most devices that legitimately have the Play Store) or it doesn't (e.g., Kindle Fire). You cannot change that fact.

Categories

Resources