Error after installing .apk in android device - android

I have developed one Android application. I have installed the .apk in Samsung Galaxy Pop. It has installed successfully but when I'm trying to open it, it gives me an error "Application is unexpectedly close". The application works fine on emulator. I don't know what is the problem. Please someone give me proper suggestions regarding it.

first of all check screen sizes in manifest..
check all permissions ur application need is added in ur manifest?
check versions supported by your application..
<uses-permission />
<permission />
<permission-tree />
<permission-group />
<instrumentation />
<uses-sdk />
<uses-configuration />
<uses-feature />
<supports-screens />
<compatible-screens />

Please, post your code here:
-> Activity launcher
-> XML's Activity launcher
-> Android Manifest
Blockquote
Check these things:
-> All of Jigar Patel wrote, and:
-> Make sure that the Launcher Activity has declared in Mainfest.
-> Check your package in Mainfest
-> Permissions
Put your error log here, because there are a lot of possibilities to solve.
Is your error about library? You have to check your build path library.
But, if your error (in a logcat) is about "NullpointerException", try to correct your code.

Related

Why my SAP application for Android is being deleted after installation

I was playing lately with my Samsung Gear 2 (not S2) smartwatch and I have created a new watch-face for it. I would like to show a weather information on it and I have found that for that task I need to use Samsung Accessory Protocol (SAP).
I followed the Samsung tutorial to create a demo app to learn how to use SAP.
I had a problem with deploying Tizen app to my watch but I found out that the lowest currently (2017) available API is 2.3.1 where Gear 2 Smartwatch has 2.2.
After changing in the config.xml the
<tizen:application id="XQKp7NYwyM.SimpleSAPConsumer" package="XQKp7NYwyM" required_version="2.3.1"/>
to
<tizen:application id="XQKp7NYwyM.SimpleSAPConsumer" package="XQKp7NYwyM" required_version="2.2"/>
my application was deployed.
I created a certificate to build a signed wgt package.
I also created an android provider application according to the tutorial.
Added new certificate and created a signed apk.
I copied the apk to the Samsung Galaxy S3 phone and tried to install it.
Installation ended without any problem.
However, after some seconds or when I try to initialize the communication from the watch I get the "Unknown sources" information from Gear Manager and my app is being deleted.
I already checked "Allow unknown sources" in the android, Gear Manager and allowed USB debugging on the smartwatch (because this is my first question here I am not allowed to post more than 2 links, so I had to give one link with all screenshots there, sorry).
Why my application is being deleted and what should I do to have it working correctly.
Tizen App - Consumer
Build using Tizen Studio 1.1.0.
config.xml
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="http://yourdomain/SimpleSAPConsumer" version="1.0.0" viewmodes="maximized">
<tizen:application id="XQKp7NYwyM.SimpleSAPConsumer" package="XQKp7NYwyM" required_version="2.2"/>
<content src="index.html"/>
<feature name="http://tizen.org/feature/screen.size.all"/>
<icon src="icon.png"/>
<tizen:metadata key="AccessoryServiceLocation" value="res/xml/accessoryservices.xml"/>
<name>SimpleSAPConsumer</name>
<tizen:privilege name="http://developer.samsung.com/privilege/accessoryprotocol"/>
<tizen:profile name="wearable"/>
</widget>
accessoryservices.xml
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<application name="HelloAccessoryConsumers">
<serviceProfile role="consumer" name="sapsample" version="1.0" id="/sample/hello">
<supportedTransports>
<transport type="TRANSPORT_BT"/>
<transport type="TRANSPORT_WIFI"/>
</supportedTransports>
<serviceChannel id="123" reliability="enable" priority="low" dataRate="low"> </serviceChannel>
</serviceProfile>
</application>
</resources>
I can provide rest of the Tizen code (main.js, index.html) if it is needed. Right now I do not think that this has any value to the problem I am facing.
Android App - Provider
Build using Android Studio 2.2.3
Structure:
app
->assets
-->SimpleSapConsumer.wgt
->libs
-->accessory-v2.5.0.jar
-->sdk-1.0.0.jar
->src
-->main
--->java
---->com.sap.baks.sapapp.service
----->SapServiceProvider.java
--->res
---->xml
----->sapservice.xml
---->AndroidManifest.xml
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sap.baks.sapapp">
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="25" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="com.samsung.accessory.permission.ACCESSORY_FRAMEWORK"/>
<uses-permission android:name="com.samsung.wmanager.APP"/>
<uses-permission android:name="com.samsung.wmanager.ENABLE_NOTIFICATION"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<service android:name=".service.SAPServiceProvider">
</service>
<receiver android:name="com.samsung.android.sdk.accessory.RegisterUponInstallReceiver" >
<intent-filter>
<action android:name="com.samsung.accessory.action.REGISTER_AGENT" />
</intent-filter>
</receiver>
<receiver android:name="com.samsung.android.sdk.accessory.ServiceConnectionIndicationBroadcastReceiver" >
<intent-filter>
<action android:name="com.samsung.accessory.action.SERVICE_CONNECTION_REQUESTED" />
</intent-filter>
</receiver>
<meta-data
android:name="AccessoryServicesLocation"
android:value="/res/xml/sapservices.xml" />
<meta-data
android:name="GearAppType"
android:value="wgt" />
</application>
</manifest>
sapservice.xml
<resources>
<application name="SAPapp">
<serviceProfile
id="/system/sapsample"
name="sapsample"
role="provider"
serviceImpl="com.sap.baks.sapapp.service.SAPServiceProvider"
version="1.0"
serviceLimit="ANY"
serviceTimeout="10">
<supportedTransports>
<transport type="TRANSPORT_BT"/>
<transport type="TRANSPORT_WIFI" />
</supportedTransports>
<serviceChannel
id="123"
dataRate="low"
priority="low"
reliability="enable"/>
</serviceProfile>
</application>
</resources>
sapserviceprovider.java
I put it together with screenshots because it is quite long.
******** EDIT **********
After trying to install sample applications as #Iqbal advised I had the following results:
Tizen
I was not able to install application on my watch until I changed the API to 2.2. If the API was greater I have seen the following error:
[Initializing the launch environment...]
RDS: On
Target information: SM-R380
Application information: Id(VbsgE6bms2.HelloAccessoryConsumer), Package Name(VbsgE6bms2), Project Name(HelloAccessoryConsumer)
[Transferring the package...]
Transferred the package: wgt stream -> /opt/usr/apps/tmp/HelloAccessoryConsumer.wgt
[Installing the package...]
path is /opt/usr/apps/tmp/HelloAccessoryConsumer.wgt
start process (install)
....
error : 61
end process (fail)
processing result : FATAL_ERROR [61] failed
spend time for pkgcmd is [1537]ms
cmd_ret:61
An exception occurred
(Installing the package... > Fail)
An exception occurred
Unexpected stop progress...
(8.239 sec)
Summary: I have installed the application with API 2.2 and no other changes done.
Android
Using the sample application without changing anything I was able to run it and connect with the smartwatch! Yupi :) !
But I needed to know why the code I used for the first time was wrong, even if I've got it from Samsung tutorial and website.
I have found that the application is being uninstalled only if I have these lines in AndroidManifest.xml
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="com.samsung.accessory.permission.ACCESSORY_FRAMEWORK"/>
<uses-permission android:name="com.samsung.wmanager.APP"/>
<uses-permission android:name="com.samsung.wmanager.ENABLE_NOTIFICATION"/>
If I replaced the lines above with the lines below
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="com.samsung.accessory.permission.ACCESSORY_FRAMEWORK" />
<uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />
<uses-permission android:name="com.samsung.WATCH_APP_TYPE.Companion" />
<uses-permission android:name="com.samsung.wmanager.ENABLE_NOTIFICATION" />
everything was OK.
Can someone explain me why it is so?
******** EDIT 2 **********
For those who will search for the answer to the question from previous edit.
I have found it here
Long story short:
<uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />
is the line that has to present - otherwise the app will be deleted from an android device. I have not found this in any documentation to be honest.
Moreover,
<uses-permission android:name="com.samsung.WATCH_APP_TYPE.Companion" />
defines that the smartwatch application will be installed separetly from an android application.
After changing Companion to Integrated one tells that a smartwatch application is intergrated and will be installed with an android provider app.
Follow
Programming guide .
API Reference.
Download the sample app from SAMPLE section and make sure that this sample app is running on your Gear 2 and Android.

android app force closing in release mode

I have finished developing an Android app. I'm using android studio. Everything is working fine when I normally run the app in debug mode on my device. Not even an exception.
But when I followed Google's guidelines on creating the signed release version of my app and installed it in my device, the app is force closing as soon as I launch it.
I just can't figure out a way to locate what the problem is. I created the release version using the "Generate signed apk" option in the Android studio IDE. Then I copied it in my device and installed the app. And then when I run, it just stops working immediately.
I don't know what more info should I give here because I just can't infer the cause of this issue.
Please help. What can be the possible reasons behind such problems.? And how can I find them?
EDIT:
Everytime I unlock the device, it is displaying the dialog "MyApp has stopped working". There's nothing in the logcat. I have no idea why this might be happening. My app uses these permissions:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="com.mypackagename.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.mypackagename.permission.C2D_MESSAGE" />
I solved the issue on my own.
First of all, you can use a tool named "monitor", present in the android sdk tools to debug your release version. This tool shows everything that happens in your device.
I used the tool and found out that the problem occurred because I had enabled proguard in my app and forgot to add rules for third party libraries used in my app.
So all those who might be facing this problem, check your proguard file and make sure you've added the required rules for all third party libraries as well.

how to use SET_DEBUG_APP permission

I found the SET_DEBUG_APP permission - it seems to grant permission to do exactly what I need to do at the moment - unfortunately I found no documentation on how to use it - can anybody shed some light on how to use it?
Like any other permission, add it to the AndroidManifest.xml file.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.somebody.amazing_app" >
...
<uses-permission android:name="android.permission.SET_DEBUG_APP" />
...
<application
...
</application>
...
</manifest>
Most of my devices don't need this; they debug just fine without this line. But one of my devices insists--it won't start running the app in debug mode without this line.

Google MapFragment is blank (white) with Could not find class 'maps.j.k'

I'm trying to build the official android google map api v2 sample on a (gingerbread 2.3.5) phone .
I added android-support-v4.jar to official sample project.
I took the sample from the official tutorial in <android-sdk>/extras/google-play-services/samples/maps
I copied the sample app in Eclipse, reference the google-play-services_lib project as an Android library, and build the whole thing with the Android SDK 4.1.2 (api 16).
Unfortunately, ahen I launch the app the map is blank and I don't have any exception or message.
The only thing I got are those suspicious lines in the logcat :
Unable to resolve superclass of Lmaps/a/du; (411)
Link of class 'Lmaps/a/du;' failed
Unable to resolve superclass of Lmaps/a/ej; (2363)
Link of class 'Lmaps/a/ej;' failed
Unable to resolve superclass of Lmaps/j/k; (2379)
Link of class 'Lmaps/j/k;' failed
ERR Could not find class 'maps.j.k', referenced from method maps.y.ae.a
VFY: unable to resolve new-instance 3571 (Lmaps/j/k;) in Lmaps/y/ae;
I suspect that my project structure in eclipse 3.8 is somewhat messed up.
I tried the following things (even the most idiotic) to no avail.
1. Invalid api key ?
I generated a "debug.keystore" with keytool and updated the eclipse preference (Android/Build/Keystore).
Of course, I registered that new keystore/SHA1 and get a new api key that I used in the AndroidManifest file
2. Wrong project target ?
I tried to build my two projects with the following targets :
Android 4.2.1
Google Api 4.2.1
3. adding google-play-services_lib as a project dependency
I tried to add google-play-services_lib as a project dependency on top of being added as an android library in the demo build path.
And tick the matching export checkbox.
4. test google maps api v2 on the phone
I downloaded trulia real estate app that is said to use the v2 api on the phone to be sure that the phone is compatible with the new api
Here is the manifest for the sample app
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mapdemo"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="com.example.mapdemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE" />
<!-- Copied from Google Maps Library/AndroidManifest.xml. -->
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!-- External storage for caching. -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- My Location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Maps API needs OpenGL ES 2.0. -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<!-- End of copy. -->
<application
android:hardwareAccelerated="true"
android:icon="#drawable/ic_launcher"
android:label="#string/demo_title" >
<!-- You must insert your own Google Maps for Android API v2 key in here. -->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="XXXXXXXX" />
<activity android:name=".MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".BasicMapActivity"
android:label="#string/basic_map" />
<activity
android:name=".CameraDemoActivity"
android:label="#string/camera_demo" />
<activity
android:name=".EventsDemoActivity"
android:label="#string/events_demo" />
<activity
android:name=".GroundOverlayDemoActivity"
android:label="#string/groundoverlay_demo" />
<activity
android:name=".LayersDemoActivity"
android:label="#string/layers_demo" />
<activity
android:name=".LocationSourceDemoActivity"
android:label="#string/locationsource_demo" />
<activity
android:name=".MarkerDemoActivity"
android:label="#string/marker_demo" />
<activity
android:name=".OptionsDemoActivity"
android:label="#string/options_demo" />
<activity
android:name=".PolygonDemoActivity"
android:label="#string/polygon_demo" />
<activity
android:name=".PolylineDemoActivity"
android:label="#string/polyline_demo" />
<activity
android:name=".ProgrammaticDemoActivity"
android:label="#string/programmatic_demo" />
<activity
android:name=".TileOverlayDemoActivity"
android:label="#string/tile_overlay_demo" />
<activity
android:name=".UiSettingsDemoActivity"
android:label="#string/uisettings_demo" />
<activity
android:name=".RawMapViewDemoActivity"
android:label="#string/raw_mapview_demo" />
<activity
android:name=".RetainMapActivity"
android:label="#string/retain_map" />
<activity
android:name=".MultiMapDemoActivity"
android:label="#string/multi_map_demo" />
</application>
</manifest>
Here are some screenshots of my project structure/build path.
I think maybe you make something wrong when you apply the api KEY.
I have the same problem, and at last I found that I turn on the incorrect service. at https://code.google.com/apis/console/,
There are Google Maps API v2 and Google Maps Android API v2.
You should use Google Maps Android API v2.
I had exactly the same problem (all configurations the same, maps.j.k stuff in the logcat). However, for me choosing Google APIs as build target solved it. But that was Google APIs 4.2, so I suggest that you install the update and try with the more recent target.
I resolved this issue by changing de targetSdkVersion with de last targetSdkVersion avaiable, at the AndroiMainfest.xml file.
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
Are you using ProGuard? Usually class names like "a", "b", etc. are a result of ProGuard obfuscating class names, and maybe the Maps API breaks when that happens. If that's the case, you will either have to disable ProGuard or add some -keep lines to your proguard.cfg file. This post shows what those lines might look like.
In my case it was due to 2 issues
on my phone the latest Google Maps app was not installed (in fact there was no google maps at all)
I didnt have all the required permissions set in my manifest
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
As documented in https://developers.google.com/maps/documentation/android/start#installing_the_google_maps_android_v2_api
http://developer.android.com/sdk/index.html --this is the link for the adt bundle in android..try downloading this and start over again..maybe there's a problem with your ADT.
Check the console API you've enabled Google Maps Android API v2
I was dealing with same issue. I tried to implement the com.example.mapdemo and had a heck of a time.
I copied the code of the BasicMapActivity to a clean new project and made the Libraries look as above.
Basically, I couldn't get either to work. I got the "Authorization failure" error in the debugger.
Then, today, I prepared new keys specifically for each project with the specific com.example.xxx after the semicolon when preparing the key in the Google Console.
I did Project->Clean at every step.
I ran it in debugger first, then just Run. And, if I remember, a few times after making the change to the manifest.
Then, finally, they worked. It seemed, in the end, to require a key for each specific project.
Here's what worked for me. When you use the Google APIs Console to create your API key, be sure to append ;com.example.mapdemo to the SHA1 fingerprint. (I was using something else more appropriate for another app I'm currently developing.) What clued me in on this solution was an authorization error in the LogCat.
In my case I added LocationSource Interface so I can get location data but i forgot to add :
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
at Manifest file.
Don't forget to use separate keys for debug and release version of the app!
If you have already tried everything, try to uninstall and reinstall again your app: on my phone (S3 mini), after the first launch with the wrong key, I corrected it, but it didn't work until a complete uninstallation.
Maybe some sort of caching is used.

Android Application is not installed

I tried signing the application and tried just debugging it. I have the Galaxy nexus. i have been able to run on the device before but now when I compile and build it shows up on the device but when i try and run it it tells me the application is not installed. I have tried to reinstall it too!
thanks
You need to add Internet permission for the app you're installing, in its manifest file, by adding the following line to the manifest file:
<uses-permission android:name="android.permission.INTERNET" />
Do this before the <application ...> tag

Categories

Resources