See only home screen and not my app when running the App - java

I'm really freaking out of this problem, I've tried anything. Nothing works. When I run the app, android emulator just loads, shows the home screen and then nothing happens (I don't see my app running), just nothing. What should I do?
EDIT: Console code shows:
[2012-07-04 00:20:17 - MyAPPP] Android Launch!
[2012-07-04 00:20:17 - MyAPPP] adb is running normally.
[2012-07-04 00:20:17 - MyAPPP] Performing com.exame.myappp.MainActivity activity launch
[2012-07-04 00:20:17 - MyAPPP] Automatic Target Mode: launching new emulator with compatible AVD 'MonoForAndroid_API_8'
[2012-07-04 00:20:17 - MyAPPP] Launching a new emulator with Virtual Device 'MonoForAndroid_API_8'
LogCat doesn't show anything
EDIT2: Manifest as requested :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.exame.myappp"
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="#style/AppTheme" >
<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>
</application>

this could be an issue with Eclipse, sometimes when I run eclipse I have the same problem where the emulator runs, my app fails to run and when I try to run the app again I have a new emulator running. What I usually find myself doing is build/clean the project, restart eclipse and then start again.
Sorry for the old techie "off/on" answer, hope it sorts itself out.

Make your manifest look like this:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.exame.myappp"
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="#style/AppTheme" >
<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>
</application>

Related

Android external activity fails

I'm trying to set up android multiple file chooser from https://github.com/paulasiimwe/Android-Multiple-file-Selector-Dialog.
I've added dependency to this library from my project.
Problem is app just fails when I click "run as android application".
Log:
[2015-01-30 01:55:19 - PhotoSigner] Android Launch!
[2015-01-30 01:55:19 - PhotoSigner] adb is running normally.
[2015-01-30 01:55:19 - PhotoSigner] Performing com.vladimir.photosigner.MainActivity activity launch
[2015-01-30 01:55:19 - PhotoSigner] Automatic Target Mode: using device 'HT17MV800004'
[2015-01-30 01:55:19 - PhotoSigner] Uploading PhotoSigner.apk onto device 'HT17MV800004'
[2015-01-30 01:55:26 - PhotoSigner] Failed to install PhotoSigner.apk on device 'HT17MV800004': timeout
[2015-01-30 01:55:26 - PhotoSigner] Launch canceled!
Here is my android manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com`enter code here`.vladimir.photosigner"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<activity android:name="paul.arian.fileselector.FileSelectionActivity" />
<activity android:name="paul.arian.fileselector.FolderSelectionActivity" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.vladimir.photosigner.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>
</application>
</manifest>
And my code calling external activity:
import paul.arian.fileselector.FileSelectionActivity;
...
setContentView(R.layout.activity_main);
Intent intent = new Intent(getBaseContext(), FileSelectionActivity.class);
startActivityForResult(intent, 0);
...
onActivityResult is exactly same as man said in https://github.com/paulasiimwe/Android-Multiple-file-Selector-Dialog.
Could anyone help with that?

The app works fine on AVD, but not on real device

I really have very big problem with my project. When my phone is connected to the computer via USB cable, everything works fine, but when the phone is disconnected the app doesn't work as I expected. So, I have already tried with android.os.Debug.waitForDebugger(), I removed the all #SuppressLint("NewApi"), also USB debugger is activated on my phone, but I think the problem can be in the Manifest file. Can someone tell me, what can be done in this case?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.androproject"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/fritz_logo"
android:label="#string/app_name"
android:theme="#style/AppTheme"
>
<activity
android:windowSoftInputMode="adjustPan"
android:name="com.example.androproject.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/ThemeWithCorners"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.androproject.RegisterDnsAndUser"
android:screenOrientation="portrait"
android:theme="#style/ThemeWithCorners"
android:configChanges="keyboardHidden|orientation"/>
<activity
android:name="com.example.androproject.MenuApp"
android:screenOrientation="portrait"
android:theme="#style/ThemeWithCorners"
android:configChanges="keyboardHidden|orientation"/>
</application>
</manifest>
I am using the following, handler code. When I put 40000 ms, the app works, but when I put 60000 ms, my application doesn't work if the cable is disconnected.
handler.postDelayed(myRunnable = new Runnable(){
#Override
public void run() {
if(btnToggle.isChecked()){
btnToggle.setChecked(false);
btnToggleTimer.setChecked(false);
}else{
btnToggle.setChecked(true);
btnToggleTimer.setChecked(false);
}
}
}, min*60000);
Most likely you have enabled the "Stay awake"-mode in the Developer options in the settings menu. When you disconnect the phone from the charger it will go into sleep mode after a few seconds.
The solution is to either use a partial wake-lock using the PowerManager or (in the above case) use a PendingIntent and the AlarmManager to trigger a event at a later time.

My app gets the error "Unfortunately, App has stopped." every time I load it

I was initially trying to add a splash page to my app, and followed a tutorial on how to do so. However, now every time I load my app, it does to a white screen for a few seconds before saying "Unfortunately, [App] has stopped."
I was unable to find a way to copy LogCat, so here's an image of the errors which appear:
Also, here's my Manifest XML:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bipbapapps.leagueclickerapp"
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=".Splash"
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=".MainClass"
android:label="#string/app_name">
<intent-filter>
<action android:name="com.bipbapapps.leagueclicker.CLICKER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
Deleting the splash Java and activity from the manifest does nothing to help now (and when I deleted it, I did revert MainClass to .LAUNCHER .
Can anyone make sense of the list, and/or help me run my app again?
From the logs, I found that you should
Call the requestFeature before setContentView();
The error says it you are calling setContentView() before requestFeature(). Don't do it.
LogCat should show you the problem. Click on all the error lines in the LogCat until you will be redirected to the problem.
I, myself, found that your problem could be at: Splash.java, line 19
Go check it out, hope it helps!

Android Multi Window doesn't work when android:screenOrientation="portrait"

as the title says, when the next line of code
android:screenOrientation="portrait"
is entered in my Manifest file then when I start my app and, for example, dragging the gallery app to it then its not activating the multi window feature which splits the screen... but just replace my app with the gallery app, meaning the gallery app takes all the screen instead of taking only half of it.
If I first open the gallery app and then dragging my app then its working fine.
Also if I remove the above line of code then its working fine.
This is my Manifest.xml file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.samsunmultiwindowstest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.samsunmultiwindowstest.MainActivity"
android:screenOrientation="portrait"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity>
<uses-library android:required="false" android:name="com.sec.android.app.multiwindow"> </uses-library>
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:value="598.0dip" />
</application>
how can I force portrait mode and get the multi window feature?
Thank you and sorry for my English.
Check out this Link Screen Orientation. It will help you understand different kinds of screen orientation. Also check this and this. will help you to enable multi window feature
I simply took out the size settings to solve my multiWindow issues.
IE: Remove these lines altogether.
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:value="598.0dip" />

Android "Hello World" Error

I'm new to Android development. I'm running Eclipse with the ADT plugin and installed all the necessary dependencies. I open up Eclipse, select 'New Android Applciation' and everything is set. When I run the app, I get an error message saying
/home/parallels/workspace/test/AndroidManifest.xml: 2: /home/parallels/workspace/test/AndroidManifest.xml: Syntax error: newline unexpected
So I look in Android Manifest and it's just the default, Eclipse generated code, right? What's the problem here?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.test.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>
</application>
</manifest>
Is there any empty space above your first line in your manifest? That has to be at the very top. Also have you compiled anything successfully thus far? Maybe something didn't get imported properly. I recommend android studio. It's just Googles modified version of eclipse that specializes in android development. It comes with everything you need all ready to go.

Categories

Resources