I've a really weird behavior with the App widget:
I've a home screen widget with a ListView showing data from internet.
It's working fine with no problem at all on the debug version,
but when I install release:
when I drag the widget to the home screen it shows "problem loading widget" and in the Logcat:
E/ResourcesManager: failed to add asset path /data/app/com.askelp.askelp-u7QWKA4gT6KmeGou17fWHw==/base.apk
E/RemoteViews: Package name com.askelp.askelp not found
BUT if I left it in the home screen and reinstalled the app it works then, and if I removed the widget from the home screen and reinstalled it again and dragged it again to the home screen it shows the same error and "problem loading widget"
Anyone has any idea?
EDIT:
I tried now to run it on my phone it's working, so it's working on my phone but not working in the emulator!
Solution1 :
Have you try to invalidate cache/restart?
Solution 2:
From the Documentation Link , You can only use this as widgets
A RemoteViews object (and, consequently, an App Widget) can support the following layout classes:
*FrameLayout
*LinearLayout
*RelativeLayout
*GridLayout
And the following widget classes:
*AnalogClock
*Button
*Chronometer
*ImageButton
*ImageView
*ProgressBar
*TextView
*ViewFlipper
*ListView
*GridView
*StackView
*AdapterViewFlipper
Related
I'm trying to add a custom action to the media session's playback state, so it can show an addition button on Android Auto. The code is indeed simple, the button is added and I can receive its callback, but the problem is the button doesn't have an icon:
The code:
val builder = PlaybackStateCompat.Builder()
builder.addCustomAction(
"ACTION_TEST",
"TEST LABEL",
R.drawable.ic_test // I tried vector drawable, png,... nothing works
)
// ...
mediaSession.setPlaybackState(builder.build())
The result: the added button doesn't have an icon, only shows a ripple effect (the circle in the screenshot) when I click it, otherwise it's invisible.
I found out the root cause. It's because Android Studio auto-optimizes the build process to produce minimal APK that can run on current ADB-connected devices.
In my case, AS included only xhdpi resources in the debug APK, therefore Android Audio HeadUnit couldn't load the drawable. Basically, AS silently changed the Gradle config to somewhat like this:
android {
...
productFlavors {
dev {
resConfigs "xhdpi" // <- root cause
}
...
}
}
I can simply run my app from the terminal to get rid of this problem.
If you have the same problem, just ensure the drawable is available for all screen densities (hdpi, xhdpi,...), and check your APK whether it's packaged with resources in all screen densities.
For me, the problem was resolved when I cleared the data of Android App application on my phone.
Was using it to run DHU emulator on desktop. Somehow its caching went awry.
I am building a kivy based Android app. At the moment when I run the app on Linux the MDToolbar shows the menu icon without a problem. But when I build the app for Android with menu icon dosent show up. The lambda function works even if the icon is not presented.
Here is an image that shows the problem.
This is the kv code.
MDToolbar:
id: mainToolbar
title: "APP name"
left_action_items: [['menu', lambda x: navDrawer.set_state("open")]]
Any ideas why is this happening?
I've been able to fix this by upgrading Kivy to version 2.0.0.
The code that I'm using was imported directly from this example code:
https://github.com/plaid/link/tree/master/webviews/examples/android
When I run the app in Android Studio on a Nexus 5X emulator I see this:
Empty Menu
It then goes to the loading screen:
Loading
The app then switches between the two as if it were constantly refreshing. I see the empty menu then the loading screen pops up, then back to the empty menu then loading screen again.
I'm very new to Plaid so there might be something very simple that I'm missing but thanks for the help!
In the initialize link step, replace [PLAID_PUBLIC_KEY] with the public key provided to you. If you haven't registered for an account with Plaid, you have to do that first.
linkInitializeOptions.put("key", "[PLAID_PUBLIC_KEY]");
An HTTP request is sent with the public key, and the shouldOverrideUrlLoading function will keep getting called upon response without a valid public key, perpetuating the refresh cycle that you see.
I have a simple Android app (built with Mono for Android), which has a problem with it's icon.
The icon is correct in Launcher and in Task Switcher, but
In Manage Apps and in Task Manager it's displayed a generic Android icon
I've checked the various density resources and the manifest and they all look correct.
(I'm seeing this on a Galaxy S phone and on a Nexus 7)
Most likely you set the icon property for your activities within AndroidManifest.xml, but did not set it for the application.
It occurs to me, that the app icon is somehow being cached in the app manager, so that deinstalling and reinstalling the app does not always change the icon properly. Rebooting the device could help.
Also i found this post very useful: adding application ids in gradle usually solves the problem.
Open "AndroidMenifest.xml" in the Package Explorer and click on the "Application" tab at the bottom. Look at the "icon" field and enter the location for your icon ( Ex: #drawable/iconimage). Next, go into the "AndroidManifest.xml" tab and look for android:icon=, adding the location to that as well (Ex: android:icon="#drawable/iconimage)
Make sure you have the same icon name in both locations!
Oleg and Collin are both right but for completeness - in a Mono app the icon can be set with attributes on the Application object (if you have one):
[Application(Label = "MyAppName", Icon = "#drawable/icon")]
class MyApp: Application
{ ...
In my project I have an error in run time: failed to get tags 4/15,although it works without "ANR" dialog.But some times in project main activity,when it becomes visible,background changes and an icon's background becomes activity's background.I checked my code,every things is in it's place and when I debug project,background name is true,even when it's background is wrong.Really I am not sure that this problem is in about that error,but when I try debugging,only this error is appearing in LogCat.
How I can solve this problem?I use eclipse.