So I've managed to get the settings button to appear while in the preview for my live wallpaper. The only issue I'm having is that it's not shooting me to my preference activity. (I've logged it and I never enter the activity).
I have a feeling I must have made a mistake in the XML somewhere... But I cant seem to spot it.
Here's my wallpaper.xml
<?xml version="1.0" encoding="utf-8"?>
<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
android:thumbnail="#drawable/icon"
android:description="#string/wallpaper_description"
android:settingsActivity="com.company.app.package.LiveWallpaperPrefs">
</wallpaper>
Here's the relevant snippet from my manifest.
<service
android:name="com.company.app.package.LiveWallpaperService"
android:enabled="true"
android:icon="#drawable/icon"
android:label="app"
android:permission="android.permission.BIND_WALLPAPER" >
<intent-filter android:priority="1" >
<action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter>
<meta-data
android:name="android.service.wallpaper"
android:resource="#xml/wallpaper" />
</service>
<activity android:name="com.company.app.package.LiveWallpaperPrefs"/>
Anybody know why It's not sending me to my LiveWallpaperPrefs when I press settings? It's actually currently giving me an error "Unfortunately, Live Wallpaper Picker has stopped."
Thanks!
Actually figured it out... I wasn't giving the system permission to enter that settings portion of my app from outside of my app... Here's what fixed my code.
In the manifest (replacing the old LiveWallpaperPrefs)
<activity android:name="com.company.app.package.LiveWallpaperPrefs">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
You could export the LiveWallpaperPrefs like this:
<activity
android:name="com.company.app.package.LiveWallpaperPrefs"
android:exported="true" />
I realize this question is a bit old, but I was having a similar problem. None of the suggestions I found online seemed to be working. No matter what I did, the settings would not display when you tapped the button.
After wasting about 3 hours, I realized that it WAS working, but for some reason I had to completely REMOVE the app from the device and re-install it fresh.
Usually, cleaning the project and re-uploading it to the device actually changes the app. But for some reason the change would not take effect until the app was removed and re-installed.
Hope this helps someone in the future!
Related
The problem occurred overnight. One day, everything worked fine. I shut my computer down and started it back up on another day. However, without changing a thing, I tried to launch my App on the same virtual device I had before and somehow it wont launch because:
"Error running 'app'. Default Activity not found."
My manifest looks like this. I changed the package name and the two activities below (see comments below). The rest is exactly the same.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="MyPackageName">
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".LoginActivity"
android:label="#string/title_activity_login"
android:screenOrientation="portrait">
<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"
android:screenOrientation="portrait">
</activity>
<activity android:name=".AnotherActivity" />
<activity android:name=".OneMoreActivity">
</activity>
<meta-data
android:name="io.fabric.ApiKey"
android:value="364e8b3f6acfddf9ad32bed8c1503bb762b19cd5" />
</application>
</manifest>
And normally my app would just start with the Login Activity. However, now it does not. I tried to "Invalidate Caches / Restart". Nothing changed. I restarted AS multiple times. Still, nothing.
Then I tried to change the Launch Options. Current Option was set to "Default Activity". So I tried to change it to a specific one. Namely, the LoginActivity. But then it tells me:
"Error running 'app'. The Activity 'LoginActivity' is not declared in AndroidManifest.xml."
It tells me it's not declared, which it clearly is. Otherwise I wouldn't be able to choose it from the dropdown in the first place. I also tried to start on another Activity. "MainActivity". Still nothing.
What exactly am I doing wrong? Is there maybe a workaround where I can manually get the APK on my virtual device so that I can at least keep working?
Edit
I already tried deleting the .gradle-folder. Sadly this didn't work. I tried pushing it to git and cloning it again in another folder. That didn't work either.
Workaround
So far I've only been able to find a workaround:
Go to Run/Edit Configurations...
Go to General/Launch Options -> Launch: Nothing
Run as you normally would. Android Studio will build the project and install the application to your device, but won't launch it!
Launch your app manually on your device.
Go to Run/Attach Debugger to Android Process.
Choose your app.
Obviously, that's a little bit of a hassle and might make debugging the start of an app more difficult. So I'm still looking for an actual solution.
I've found the answer when I tried to look for a solution to another problem that randomly popped up out of nowhere.
Androidstudio wouldnt load any previews and put warnings in my layouts, because
One or more layouts are missing the layout_width or layout_height attributes.
One solution suggested in
the answer I found for that problem
was to delete all files in
C:\Users\UserName.AndroidStudio3.2\system\caches
Thats what I did and it solved both problems. Guess the developers have some fixing to do.
so, I have a little problem, while opening my app.
I have an "ugly" popup opening for 1-2 sec and then my app goes in.
How exactly can I open my app directly without that 2 sec empty page?
btw - I changed the string of the android:name of my launcher activity to verify that it is this exact activity that is opening empty, and the name changed in the actionbar so it is this activity.
the picture of the first and "ugly" screen
<---
here's my manifest code :
<application
android:name=".BaseApplication"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Holo.Light.NoActionBar" >
<activity
android:name=".UI.activity.HomeActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
android:launchMode='singleTask'
android:theme="#style/Theme.MyAppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
anyone had this kind of problem before?
thanks a lot.
if anyone ever experience this kind of issue like me,
the solution for me was changing the theme of the app to
android:theme="#android:style/Theme.Holo.Light.NoActionBar"
thank you Kesh for relating that question!
I have spent a long time on forums looking at how to change the theme for my activities in android app development.
My main objective is to remove the title bar. But would still like to know how to change themes in general.
I have tried changing the theme using the GUI built into Android Studio... the theme changes in the preview, but when I run the app on my phone nothing changes.
So I figured I would change the theme using some xml code in the Manifest file.
What everyone seems to be doing is the following:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.dennis.activeapp" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
<!-- HERE IS WHERE I SET THE THEME -->
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">
<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=".SecActivity"
android:label="#string/title_activity_sec" >
</activity>
<activity
android:name=".FirActivity"
android:label="#string/title_activity_fir" >
</activity>
</application>
</manifest>
The above is my code.
Now, when I try to run this on my phone the app crashes. The app opens for a fraction of a second and then closes.
If it is any help my phone is the Cubot S208. Since I have a feeling the problem might not be the code, as I followed directly what people have said in previous posts/forums.
The error message I receive in the ADB logs is the following:
ddms: null
java.lang.NullPointerException
at com.android.ddmlib.Client.read(Client.java:731)
at com.android.ddmlib.MonitorThread.processClientActivity(MonitorThread.java:311)
at com.android.ddmlib.MonitorThread.run(MonitorThread.java:263)
PropertyFetcher: AdbCommandRejectedException getting properties for device 0123456789ABCDEF: device unauthorized. Please check the confirmation dialog on your device.
PropertyFetcher: AdbCommandRejectedException getting properties for device 0123456789ABCDEF: device unauthorized. Please check the confirmation dialog on your device.
However I am certain that is the code below the comment (The theme) that is causing this issue. As without it I have no crash !
i'm deploying an android application (Android 4.0.3) and when I press the home screen the application doesn't stay on the recent apps list. I've noticed that when I restart the application, it starts on the last screen i've navigated before press the home button. Anyone can help? Here is me Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="#drawable/logo_home"
android:allowBackup="true">
<activity
android:name="com.test.activity.CommunicatorActivity"
android:launchMode="singleTop"
android:label="" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.test.activity.InputActivity"
android:windowSoftInputMode="adjustPan|stateHidden">
</activity>
<activity android:name="com.test.activity.SettingsActivity"
android:windowSoftInputMode="adjustPan|stateHidden">
</activity>
<activity android:name="com.test.activity.OutputActivity"
android:windowSoftInputMode="adjustPan|stateHidden">
</activity>
</application>
</manifest>
I'm going to go out on a limb and suggest that this is your problem:
android:label=""
In your root activity CommunicatorActivity you've set the label to be an empty string. This label is used to identify your app in the list of available apps and because it is empty, this may be causing it not to show up in the list of recent apps.
Remove android:excludeFromRecents="true" from your manifest
You should use
android:label="your app_name"
2 things
Ok, there isn't something obvious in your manifest that should prevent it from appearing in your recents list.
1. Wrong identification
It's not always straight forward to tell which task contains your activity, using the GUI.
One of the possibilities is that an activity from some other app is on top of your task making you believe that your activity isn't there. Since, clearly it resumes to the last screen.
I suggest you to remove the single top temporarily and check the same.
2. Launcher modification
Has the launcher you use the standard launcher? Has the launcher or some other app modified the presentation or behavior of the recents screen (unlikely but worth a check)
For this, I suggest using a stock launcher or try the same app on a different phone or an emulator.
What would help is steps you followed and some screen shots of recents
screen and also of your app
I had the same problem.
The reason is that I had set android:label="" in manifest.xml.
I hadn't set android:launchMode="singleTop".
I declared on purpose android:label="" because I didn't find any better way to remove the title of the action bar from my main activity.
I turned android:label="app_name" again and everything now is OK; the app appears again in recent app list when pressing the home screen and doesn't start on the last navigated screen when restarting it.
I'm going through the Android 'Building Your First App' tutorial and have gotten stuck trying to run the app. I created the app and emulator with Eclipse (Juno Build id: 20120920-0800 on OS X, default installation. The Android SDK, etc. was updated today).
The app appears to be installed on the emulator. I.e. 'Home -> Menu -> Manage Apps' lists it and it's App info looks ok. (Total=24.00KB, App=24.00KB, USN storage app=0.00B, ...).
However, it does not appear in the apps launch list (i.e. the screen with 'API Demos', 'Browser', etc.
Is there some other way to launch it? Is there something I have to do to get it into the app list? Any help would be appreciated - this is driving me crazy.
thanks
In your manifest xml file you need to make sure that you have
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
in your activity definition. If you don't see your application in the launcher then it suggests you don't have "android.intent.category.LAUNCHER" set.
Your manifest file should have something like (this isn't a complete manifest)
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".MyActivity"
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>
You can't just put the intent-filter lines in your manifest. If you double click the manifest it will open up. You get 2 methods to edit it, raw XML or using a basic interface. Personally I think you're better off with the raw interface. Look below the window that opens when you double click the manifest, you'll see some tabs like Manifest, Application... the last on is AndroidManifest.xml - this is the raw xml. The first one is basic setup.
Don't forget to save your manifest file and do a clean and build then run it.