Android application won't launch on device - android

I have developed an Android application using Eclipse which works perfectly on the Android Virtual Device or when running it on my smartphone using Eclipse + USB Debugging mode enabled.
However, when I install the application on my phone using a signed apk file which resided on the sd card and try to launch it I get a "Activity not found - lsp.workshop" error, and the app won't start (lsp.workshop is the application package name).
the AndroidManifest.xml file is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="lsp.workshop"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".TwitterLogin"
android:label="#string/app_name" android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<data android:scheme="twitter" />
<data android:host="log" />
</intent-filter>
</activity>
</application>
</manifest>
What am I doing wrong? Thanks

The emulator and android with a debugger attached can behave differently then when you start an app normally. The timing is different (influences multithreading and race conditions) and other things may be affected as well.
But just to be sure:
Did you list the activity within your AndroidManifest.xml file?
Is the spelling really correct?
If those things are not the problem, then could you show some code (how do you start the activity? with an intent?) and maybe the manifest file ?

Using two intent filters instead of one solved the problem:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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="twitter" android:host="log" />
</intent-filter>

When you export your apk,be sure to name it -something.apk ,ie just put the ".apk" at the end when you export the application (y)

Related

Using intent-filter to open file type with Adobe AIR app

I'm trying to set my Adobe AIR Android app to automatically be used to open a specific type of file. I've gone through many examples of this but haven't been able to find one that works correctly (many relevant questions on SO are 4-6 years old and perhaps no longer accurate?).
Let's say I want to open a binary file with extension .abc in my app. This is what I've added to my application descriptor:
<android>
<manifestAdditions>
<![CDATA[
<manifest android:installLocation="auto">
<uses-permission android:name="android.permission.VIBRATE" />
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch" />
<application>
<activity android:name="com.example.myapp.OpenFileActivity" android:label="MyApp">
<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:mimeType="application/abc"/>
</intent-filter>
<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:mimeType="application/octet-stream"/>
</intent-filter>
<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="content" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.abc" />
<data android:host="*" />
</intent-filter>
</activity>
</application>
</manifest>
]]>
</manifestAdditions>
</android>
AS3 code (just trying to get the Invoke working before I try to add any functionality to it):
//...
NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onInvoke);
//...
private function onInvoke(e:InvokeEvent):void {
trace(e.toString());
}
After I install the app using the above code in the application descriptor, if I try to open an ABC file (for example, by tapping an attachment in Gmail) a message immediately appears "Unfortunately, [app name] has stopped."
If I look through logcat, I see the error:
E/AndroidRuntime(13835): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.myapp/com.example.myapp.OpenFileActivity}:
java.lang.ClassNotFoundException: Didn't find class "com.example.myapp.OpenFileActivity" on path: DexPathList[[zip file "/data/app/com.example.myapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.myapp-1, /vendor/lib, /system/lib]]
but if I remove the android:name="com.example.myapp.OpenFileActivity", I get a build error: Tag <activity> missing required attribute name.
What am I missing or doing wrong? Please keep in mind this is an Adobe AIR app and not a native Android app.
The problem is that the activity you are defining OpenFileActivity isn't actually a java Activity class instance in your application hence the class not found error.
We use the following for controlling the main AIR activity:
<manifestAdditions>
<![CDATA[
<manifest android:installLocation="auto">
<application>
<activity>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<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="custom_url_scheme" />
</intent-filter>
</activity>
</application>
</manifest>
]]>
</manifestAdditions>
Using the blank activity node should add the intent filters to the actual AIR application activity. So you should be able to add the other intent filters you require at that point.

unity android deep linking not working

Im developing a mobile app using unity and I want to deep link the mobile app to the website. I have edited the androidmanifest as shown in the developers site but even though the building process runs smoothly when i try to type the link on the browser and launch the app it does not work
<activity android:name="com.liveroom.liveroom.GalleryUpdater"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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="liveroom"
android:host="liveview"/>
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
</activity>
as stated in the developers article the intent should be able to access and load the app when the uri liveroom://liveview but itt does not do so. please point my mistake, thank you
When you type on browser it will not open . to test make an html file using < a href tag then it will open.
Not every browser supports deep linking, only few browser supports deep linking, like if you want to check deep linking, use google chrome latest updated browser , so when You test deep linking using QR code it will open perticular app.
Was also not working for me. What helped was to remove android:host="(...)"
So my AndroidManifest.xml now looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<application>
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:theme="#style/UnityThemeSelector" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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="unitydl" />
</intent-filter>
</activity>
</application>
</manifest>

android app installed but not able to see

I am new to android app development. I created an app using Eclipse
and successfully installed on my device. Even it got installed on
the emulator.But, I can't see it!
I have tried everything like adding :
In manifest.xml
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Re-installing
Tried directly sending and installing .apk to the device
(not only by running on eclipse)
Restarting my eclipse
and so on.
Let me know if any other information is required.
Its not going to be on the main page. Go to downloaded applications on your device and check if its there. Also make sure USB debugging in turned on in the developers options on your phone. Also read this.
What about checking the list of installed packages?
$ adb shell pm list packages | grep your.package.name
Or just look up the directory.
$ adb shell ls /data/app
If it's really installed but not be shown in the launcher, then it would be a manifest code issue, I think.
I got this problem few month ago, then i got that i am using more category and action tag in activity.
like this:
<activity
android:name="com.test.login.UserLogin"
android:label="#string/app_name"
android:screenOrientation="portrait"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="t4jsample"
android:scheme="oauth" />
</intent-filter>
</activity>
but my problem solved using this:
<activity
android:name="com.test.login.UserLogin"
android:label="#string/app_name"
android:screenOrientation="portrait"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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:host="t4jsample"
android:scheme="oauth" />
</intent-filter>
So i want to say that please check your code and let me know that you are getting some this case in your code.

My app isn't appearing in my app drawer even though it has installed

Why won't the app appear in the app drawer? It says in the App Manager that it is installed but I can't seem to open the actual app as it isn't in the app drawer. It doesn't automatically open it up once it's installed either.
Here is what is said when I choose to run on my phone (which is on Jellybean). It says the same thing when I install it to an emulator.
[2012-09-19 16:20:24 - TheForeverAloneQuiz] Performing sync
[2012-09-19 16:20:24 - TheForeverAloneQuiz] Automatic Target Mode: Several compatible targets. Please select a target device.
[2012-09-19 16:20:28 - TheForeverAloneQuiz] Uploading TheForeverAloneQuiz.apk onto device '001988a8094d8e'
[2012-09-19 16:20:28 - TheForeverAloneQuiz] Installing TheForeverAloneQuiz.apk...
[2012-09-19 16:20:31 - TheForeverAloneQuiz] Success!
[2012-09-19 16:20:31 - TheForeverAloneQuiz] /TheForeverAloneQuiz/bin/TheForeverAloneQuiz.apk installed on device
[2012-09-19 16:20:31 - TheForeverAloneQuiz] Done!
Here's the android manifest.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mikenning.foreveralonequiz"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Light.NoTitleBar" >
<activity
android:name=".Introduction"
android:label="#string/title_activity_introduction" >
<intent-filter>
<action android:name="android.intent.action.INTRO" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".QuestionOne"
android:label="#string/title_activity_introduction" >
<intent-filter>
<action android:name="android.intent.action.QUESTIONONE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".Result"
android:label="#string/title_activity_introduction" >
<intent-filter>
<action android:name="android.intent.action.RESULTS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
Anything I'm doing wrong?
SIDENOTE I also get errors saying that I do not need permission for the activities categorised as 'DEFAULT'. Could this be to do with it? I need it for the startActivity() in one of my clases so is it really not required?
I'm assuming that introduction is your first Activity. You need to add another action to it, like in the following code:
<activity
android:name=".Introduction"
android:label="#string/title_activity_introduction" >
<intent-filter>
<action android:name="android.intent.action.INTRO" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I know it is solved question, but this solution did not work for me and I wanted to share my solution here.
I was trying to add deep link support to my app, And in the documentation the
<intent-filter android:label="#string/filter_view_http_gizmos">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="gizmosexample"/>
</intent-filter>
I added those intent filters to my launcher activity and after app drawer stopped showing the app icon in the launcher.
So if #RaghavSood's solution above did not work, try to remove those filters or any other custom filters from the launcher activity's filters.

Why doesn't my android application show up in the launcher?

I'm developing an application for the Android platform targeted for api level 4 (Android 1.6) but I can't get it to show up on my phone and I can't figure out why. Here's my AndroidManifest.xml is there a problem in here? Or is there something else I should be looking at?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sbe.app.hellocogen"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".activity.ListPlants"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.AddPlant"
android:label="Add Plant">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:name=".activity.UnitActivity"
android:label="IP HERE, PLANT NAME">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="4"/>
</manifest>
When I started this application it didn't show up but I fixed it by setting the minimum api level to 4 instead of 7 then it started showing up but now it stopped showing up again and I don't know why.
I was having the exact same problem as you. It was working for one activity but not another. Eventually I realised that I had named the tag "activty" instead of "activity". This doesn't throw an error of any kind, just does not recognise the existence of the Activity!
Also, you don't need the ".activity." before the class name. Is your "ListPlants" a ListActivity? If so, this might explain your problem.

Categories

Resources