Can't open APK file on smartphone - android

I've made an application in eclipse using android project. Now I installed that APK-file on my smartphone.
When I hit install, it just installs, it's fine. But then I get the option "Cancel", or "open". But I can't click on "Open".
Just nothing happens every time I try to open it. It's not with my other apps.
I can find it at "downloads", but I just can't open it. I can update and install it again countless times. Unknown sources in my settings is on.
Does anyone know this issue, and/or how to fix it?
Help would be appreciated.
Manifest code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.rodekruis"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
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=".BezoekActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.example.rodekruis.BezoekActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".AfspraakActivity"
android:label="#string/title_activity_afspraak" >
</activity>
<activity
android:name=".ContactActivity"
android:label="#string/title_activity_contact" >
</activity>
<activity
android:name=".MeningActivity"
android:label="#string/title_activity_mening" >
</activity>
<activity
android:name=".RouteActivity"
android:label="#string/title_activity_route" >
</activity>
<activity
android:name=".SpecialistenActivity"
android:label="#string/title_activity_specialisten" >
</activity>
<activity
android:name=".BWCActivity"
android:label="#string/title_activity_bwc" >
</activity>
<activity
android:name=".AgendaActivity"
android:label="#string/title_activity_agenda" >
</activity>
<activity
android:name=".InfoActivity"
android:label="#string/title_activity_informatie" >
</activity>
<activity
android:name=".VriendActivity"
android:label="#string/title_activity_vriend" >
</activity>
<activity
android:name=".FoldersActivity"
android:label="#string/title_activity_folders" >
</activity>
<activity
android:name=".NieuwsActivity"
android:label="#string/title_activity_nieuws">
</activity>
</application>
</manifest>

Have you been able to launch it through ADB directly in Android Studio ?
You might want to do it this way during your implementation, it is much faster to build and test.
Just enable the developer mode in the settings and the "usb debugging" in the new menu that appeared (also in settings). You can now connect your phone to your computer and enjoy the simplicity of creating apps on Android.

Register your launchable Activity in AndroidManifest.xml like this-
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<!--______________Activities______________-->
<activity
android:name=".MainActivity" //launchable activity
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Hope this will help you.

Related

Can't open APK file on mobile device after installing from PC

I've made an Android application using Eclipse. It has no errors, good to go, but I wanted to test it on my own phone first. I copied the APK file to my Samsung Galaxy S6 using an USB cable. Unplugged it, made sure the file version is not higher or later than my android version on my phone.
Used an APK installer app, and it's installed. It's at my files, and I can update it how many times I want. After updating, or installing it gives 2 buttons in the button. "Ready" and "Open". "Ready" is the only one clickable, and leaves the page. I can't open the apk-file. I've followed every tutorial but I just can't open it.
This is my Manifest code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.rodekruis"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
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=".BezoekActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.example.rodekruis.BezoekActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".AfspraakActivity"
android:label="#string/title_activity_afspraak" >
</activity>
<activity
android:name=".ContactActivity"
android:label="#string/title_activity_contact" >
</activity>
<activity
android:name=".MeningActivity"
android:label="#string/title_activity_mening" >
</activity>
<activity
android:name=".RouteActivity"
android:label="#string/title_activity_route" >
</activity>
<activity
android:name=".SpecialistenActivity"
android:label="#string/title_activity_specialisten" >
</activity>
<activity
android:name=".BWCActivity"
android:label="#string/title_activity_bwc" >
</activity>
<activity
android:name=".AgendaActivity"
android:label="#string/title_activity_agenda" >
</activity>
<activity
android:name=".InfoActivity"
android:label="#string/title_activity_informatie" >
</activity>
<activity
android:name=".VriendActivity"
android:label="#string/title_activity_vriend" >
</activity>
<activity
android:name=".FoldersActivity"
android:label="#string/title_activity_folders" >
</activity>
<activity
android:name=".NieuwsActivity"
android:label="#string/title_activity_nieuws">
</activity>
</application>
</manifest>
Does anybody knows why this is, or how I can solve it? If I need to add more things, feel free to ask. I'm struggling with this and really want it to work on my phone. Thanks in advance!
Activate USB debugging. It is easier.
Also:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.rodekruis"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
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=".BezoekActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.category.DEFAULT" />
<category android:name="com.example.rodekruis.BEZOEKACTIVITY" />
</intent-filter>
</activity>
<activity
android:name=".AfspraakActivity"
android:label="#string/title_activity_afspraak" >
</activity>
<activity
android:name=".ContactActivity"
android:label="#string/title_activity_contact" >
</activity>
<activity
android:name=".MeningActivity"
android:label="#string/title_activity_mening" >
</activity>
<activity
android:name=".RouteActivity"
android:label="#string/title_activity_route" >
</activity>
<activity
android:name=".SpecialistenActivity"
android:label="#string/title_activity_specialisten" >
</activity>
<activity
android:name=".BWCActivity"
android:label="#string/title_activity_bwc" >
</activity>
<activity
android:name=".AgendaActivity"
android:label="#string/title_activity_agenda" >
</activity>
<activity
android:name=".InfoActivity"
android:label="#string/title_activity_informatie" >
</activity>
<activity
android:name=".VriendActivity"
android:label="#string/title_activity_vriend" >
</activity>
<activity
android:name=".FoldersActivity"
android:label="#string/title_activity_folders" >
</activity>
<activity
android:name=".NieuwsActivity"
android:label="#string/title_activity_nieuws">
</activity>
</application>
</manifest>
You have to have a launcher defined. The rest have to be defined as you originally defined the first activity with default and the package name. The main activity(the first to launch) has to be defined with MAIN and LAUNCHER
EDIT:
OK, I screwed up. I updated it. Action cannot be the package name:
<action android:name="android.intent.category.DEFAULT" />
<category android:name="com.example.rodekruis.BEZOEKACTIVITY" />
You did it the other way around which is why it didnt work. You have to do the default and name for all the activities. The MainActivity was written correctly

All my android app get force close in AVD

I have a problem in AVD and eclipse.
I make new android app and when I try to run it on AVD or my android device but I get force close .
Manifest file :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.azkar"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity android:name="com.your.package.YourLauncherActivity"
android:name=".main"
android:lable="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
If you are using this manifest file without any change then you need to change here from
<activity android:name="com.your.package.YourLauncherActivity"
android:name=".main"
android:lable="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
to
<activity android:name="com.example.azkar.YourLauncherActivity"
android:name=".main"
android:lable="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
Replace this
<activity android:name="com.your.package.YourLauncherActivity"
with this:
<activity android:name="com.example.azkar.YourLauncherActivity"
below line makes problem to you"
<activity android:name="com.your.package.YourLauncherActivity"
make sure with your package and activity name:
<activity android:name="com.example.azkar.YourLauncherActivity"
Change
<activity android:name="com.your.package.YourLauncherActivity"
To
<activity android:name="com.example.azkar.YourLauncherActivity"

Google Play still giving me zero devices

I'm trying to upload an update of my application in the Google Play store but I couldn't get more than 0 devices. I've tried to delete the permissions and still no luck. This is my manifest.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.compan.st"
android:versionCode="9"
android:versionName="#string/app_verion" >
<!-- PERMISSIONS -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<application
android:name="com.compan.st.app.ApplicationExt"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#android:style/Theme.Holo.Light" >
<activity
android:name=".activity.LoginActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Holo.Light.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".activity.MainMenuActivity"
android:label="#string/MainMenuStrings"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".activity.AcademicRecordActivity"
android:label="#string/ACrecord"
android:parentActivityName=".activity.MainMenuActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".activity.SemesterActivity"
android:label="#string/Semester"
android:parentActivityName=".activity.AcademicRecordActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".activity.AboutUserActivity"
android:label="#string/Aboutuser"
android:parentActivityName=".activity.MainMenuActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".activity.RewardsActivity"
android:label="#string/Rewards"
android:parentActivityName=".activity.MainMenuActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".activity.LoansActiviry"
android:label="#string/Loans"
android:parentActivityName=".activity.MainMenuActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".activity.RequestsActivity"
android:label="#string/Requests"
android:parentActivityName=".activity.MainMenuActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".activity.Preferences"
android:label="#string/setting"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".activity.AboutActivity"
android:label="#string/about"
android:parentActivityName=".activity.Preferences"
android:screenOrientation="portrait" >
</activity>
<receiver android:name="com.compan.st.activity.IntentReceiver" />
<activity
android:name="com.google.android.apps.iosched.ui.phone.ScheduleActivity"
android:theme="#style/Theme.IOSched" >
</activity>
<activity android:name=".activity.CourseInfoActivity" >
</activity>
<activity
android:name=".activity.ASchedule"
android:label="#string/schedule" >
</activity>
</application>
The previous version was compatible with most of devices "it was working with api 8".
Problem fixed. it turns out one of the JARs that are Java project I'm using in my Android project has libraries inside a folder called lib so I just move it to a new folder called libs then export the JAR, put it in my Android project then export the APK.

Following android tab tutorial, can't find or launch installed app on device or emulator

Attempting to follow this project
http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/
When I run it, it says everything installs alright but nothing comes up and it's not listed under apps. I find it under application manager.. What can cause an app to install and not launch?
edit:
Here's my manifest.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tabs"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<activity android:name="TabsFragmentActivity" >
</activity>
</application>
</manifest>
Have you got a launcher Activity?
<activity
android:name=".MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> // this
</intent-filter>
</activity>
Edit:
You did not surround it with an Activity tag, so basically you don't have a launcher Activity, fix it like this:
[...]
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity android:name="TabsFragmentActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
[...]

exported apk showing activities when installed

I have exported an app with 3 activities (main, splash and another activity called "about") to an apk file. It works fine when tested on the emulator. After uploading to the Play Store and then downloading to my own phone, it installs fine on my phone. Good so far. However, the apk doesn't appear packaged - it's showing the separate activities and not starting with the splash screen as it did in the emulator. What could be the problem? It exported with no errors. When I was exporting, I gave the apk a name that was different than the package name in the manifest. Would this cause the problem? Here is the manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.spinner"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" >
<activity
android:name=".SplashActivity"
android:label="#string/title_activity_splash" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".AboutActivity"
android:label="#string/title_activity_about" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Thank you for looking.
This intent-filter
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
tells Android launcher app to show icon associated with Activity this filter is attached to on its Launcher screen. When corresponding icon is tapped by user, launcher app starts that activity and your code is executed. You usually want one entry point in your application so edit your Manifest file and ensure only one Activity element uses it. In your case, I guess leave it for SplashActivity and remove from others. It should look like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.spinner"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" >
<activity
android:name=".SplashActivity"
android:label="#string/title_activity_splash" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
</activity>
<activity
android:name=".AboutActivity"
android:label="#string/title_activity_about" >
</activity>
</application>
</manifest>
I'd also get rid of android:label from <activity> elements (just leave for <application>)

Categories

Resources