APK not built properly - android

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?

Related

Android Studio expands Activity name in AndroidManifest.xml

I upgraded my project from Eclipse to Android Studio.
Everything is working, including different flavors (in Eclipse I had an ANT script that auto-generated the sourcecode for the different flavors).
I can also generate the different signed APK's. And these all work on the device.
Also uploading these APK's to GooglePlay is no problem.
User also get these updates, but after the update they need to re-create the shortcut to the app on the home screen. The old shortcut is removed.
I believe this is due to the fact that "Android Studio" modifies stuff in the AndroidManifest.xml when generating the APK.
In Eclipse source, in Android studio source and when I inspect the Eclipse generated APK I have the following (with the name being .StartUpActivity) :
<activity android:name=".StartUpActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
However, when I look into the generated apk from Android Studio this is modified to :
<activity android:name="be.abc.android.StartUpActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
So the name has been changed from .StartUpActivity to be.abc.android.StartUpActivity.
In the end, this is the same path but I believe the shortcut just looks at the name .StartUpActivity, and decides it is no longer available and removes the shortcut....
Can I fix this in someway that the shortcuts don't get deleted. Or that Android Studio doesn't mess with the shortened package names in the AndroidManifest.xml ?
Indeed, as soon as you modify the launcher manifest entry, the shortcut has to be recreated. To avoid such issue, you can make use of activity-alias. A step-by-step guide can be found here.

Why are there two app icons after installing on the android?

My app shows two app icons after installing it on android with React Native. Why is this happening? Any idea?
I am only using one index.js. I do not have an index.android.js and my version of React Native is 0.50.3.
My fault :( I have two activity in AndroidManifest.xml with:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Remove one and perfect :)

Unable to install app using Android Studio

I am working on an app which does not have any launcher activity. But when I try to install that app from Android Studio's Run icon, it says, 'Error running XYZApp: Default Activity not found'
I did not see such issue ever in Eclipse.
Can anyone help to fix this issue? How can I install my app in device which doesn't have any Launcher Activity.
Edit your configuration, and there in 'Launch' select 'Nothing' (or something else, what you want to run)
You must be missing the action and category for your main activity in AndroidManifest file
just add the intent filers in your activity as below :
<activity
android:name="com.example.MainActivity"
android:label="XYZApp"
android:theme="#android:style/Theme.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
If you are upgrading from Eclipse to Android Studio you might need to refresh the cache for Android Studio and restart IDE.
Follow the following steps:
File -> Invalidate Caches / Restart...
You also need to mention the Activity in the Manifest file of your Android project. You can use following code to do so: Here MainActivity will start when your app launches on the android device.
<context android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</context>
Run -> Edit Configurations.
On 'Launch' select the activity you want to start.

Eclipse installs my app twice on my android phone

I am having issues with Eclipse. I'm new to Android development so I wouldn't be surprised if I messed something up along the way.
My app installs twice on my phone. When I click 'Run', Eclipse does the usual with installation, but when it is finished, the app shows up twice (ie. two separate icons) on my phone. Any ideas what the problem is?
In your manifest:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name="com.myapp.FirstActivity"
android:theme="#style/Theme.Apptheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.myapp.SecondActivity"/>
</application>
make sure only your first activity has an intent-filter.
Uninstall both programs from the emulator. If you change the name of the program and/or change some of the settings, then it can install as a different program. My guess is after you do the install, then run that you'll only have the one icon.
Did you run two different versions of this code?
If so it will not save over the old icon but make a new one.
If this is the case trying deleting boths apps from the emulator and re-running it cleanly.
In my case I had two activities with the following intent-filter
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>

Android app won't open after i install. But it can run in emulator

I have exported my app from eclipse and installed it on my phone. After installation, I click open from package installer, but the installer force close. Afterwards, when I tried to launch the app, nothing happen after I click it. I click the app in app drawer but it return to home screen instead.
I am able to run in emulator and in debug mode when I connect my device via usb, but not when I export the apk to install.
Note that this is not the first app that I exported to install. Previous apps are working fine.
I found the problem! I had declared the activity 2 times in the manifest with different properties, like:
<activity android:name=".myclass"></activity>
and
<activity android:name=".myclass" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Remove the unwanted one from the manifest and it will work.
Check your android emulator version and the firmware version of the phone. If firmware version is not supported for that app you will be install from adb, but you cant start the app.
Check the settings to be able to install the unknown apps in
Settings->Applications and check box "Unknown Sources"
Try to check on permission in Android Manifest. I was having the same problem earlier when i install a NFC app. I forget to give permission for NFC. After i gave the permission it works fine for me. Please check your AndroidManifest.
I spent few days to identify the problem why it occurred .But I solved my problem this way- Modification in Android Manifest
<activity android:configChanges >
<intent-filter android:label="#string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<I removed my code here that i added for reference to google play store for reference >
Remove the unwanted one from the manifest and it will work.
Try to search errors in your Android manifest, i have the same problem and the problem was the 'R' in the category LAUNCHER are in lower case.
like this:
<category android:name="android.intent.category.LAUNCHEr" />
to solve it, simple:
<category android:name="android.intent.category.LAUNCHER" />
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Removing the configuration of all the modules that are not from the app worked for me. In other words, just leave the Project.app module and check its configuration.
Edit Run/Debug Configurations -> Android app -> app
GL
if you use splash in react native:
To avoid error: Binary XML file line #XXX: requires a valid src attribute
inside a layer-list, use:
<item android:drawable="#drawable/image" />
instead of:
<item>
<bitmap android:src="#drawable/image"/>
</item>
My solution is to add this flag in download manager when application is install
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
In my case - i had this flag -> intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
I replaced it with Intent.FLAG_ACTIVITY_NEW_TASK and everything worked!
My Manifest looked like this. Those that need help and have a similar manifest look bellow.
<activity android:name=".login.activities.SplashScreenActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data
android:host="example.com"
android:scheme="https"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
You just need to remove the
< data>
element in the intent-filler and it should work.

Categories

Resources