Android: PlaybackOverlayFragment not working - android

I am working on an Android TV app and when I have started working on the project code it throws an error for PlaybackOverlayFragment, stating it cannot resolve symbol PlaybackOverlayFragment
public class PlaybackOverlayFragment extends android.support.v17.leanback.app.PlaybackOverlayFragment
currently in my gradle file it reads :
compile 'com.android.support:leanback-v17:27.1.1'
The original project was in compile sdk version 26 and I upgraded it to 27, is this throwing error because of it?

PlaybackOverlayFragment was deprecated some time ago and then completely removed in v27.
You should move away from deprecated API as soon as possible because they may be removed any time in the future.
The doc says you shoud use PlaybackFragment instead which was also deprecated in 27.1.0... So now you should use PlaybackSupportFragment
Source: https://developer.android.com/reference/android/support/v17/leanback/app/PlaybackFragment

Related

Android Webview Chromium UnitTests fail with java.lang.NoSuchMethodError

We are currently facing this NoSuchMethod Error when we want to create the unit test with Robolectric version 4.3.1 and Mockito version 2.18.3
Exceptions:
java.lang.NoSuchMethodError: 'void com.android.webview.chromium.WebViewChromium.<init>(com.android.webview.chromium.WebViewChromiumFactoryProvider, android.webkit.WebView, android.webkit.WebView$PrivateAccess, boolean)'
Here is the code we did:
mWebView = Mockito.spy(
new WebviewChromium(
mockWebViewChromiumProvider, webView, webView.new PrivateAccess(), false));
In BUILD.gn, we have included the "//android_webview/glue:glue_java" as dependency, we can successfully compile the code but it sounds like in the runtime, it refers to the another wrong jar, does someone know how to config the build file to use the correct jar or any ideas about how to solve this error?
did you check this followjng thread https://github.com/robolectric/robolectric/issues/5092 and this one I think you need open jdk 11 or 13 I recently had the same issue after adding open jdk 13 to android studio it solved my problem robolectric started working fine you can check following thread as well https://github.com/robolectric/robolectric/issues/5092

Gesture Builder in API 27

I try to learn Gesture Handling in Android and I tried this tutorial: www.techotopia.com/index.php/Implementing_Android_Custom_Gesture_Recognition_with_Android_Studio
My problem is, that I can not download Samples for SDK in my Android Studio 3.0.1 because there is just no option called like that:
So I tried this App on Appstore: https://play.google.com/store/apps/details?id=pack.GestureApp
But when I try to read the file like this:
gLibrary = GestureLibraries.fromRawResource(this, R.raw.gesture);
the gLibrary is always empty.
So I tried to find the official Gesture Builder Application here: https://developer.android.com/samples/index.html and in Android Studio: File/New/Import Sample:
as u can see, nothing there too.
I also tried to get a old (API 17) version running: https://github.com/Miserlou/Android-SDK-Samples
but I just got errors over and over again.
So lets get to my question. How to build a gesture file today with API 26/27 or how to get the old Gesture Builder (running).
I solve this problem by downloading all API 27 package

How to Solve "The "XamlCTask" task failed unexpectedly" error without updating xamarin.forms version

I am stuck in one of my issue in xamarin.forms. In my xamarin.form project xamarin.form package version is 2.3.2.123 in PCL,Android and IOS.
Since Last few days when I am trying to build my iphone project, its gives me an error
The "XamlCTask" task failed unexpectedly
So I have updated xamarin.form version in PCL, Droid and IOS.
but due to this I am facing issue in Android in one of my page
{Java.Lang.NullPointerException: Attempt to invoke virtual method
'boolean android.graphics.Bitmap.isMutable()' on a null object
reference at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
[0x0000c] in <3fd174ff54b146228c505f23cf75ce71>:0 …}
I am using
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
Instead
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
because I want to scroll page even when keyboard is open. If keyboard is open then page can't be scroll in android this is the bug of "App Compact".
Now I don't understand what should I do?
Is there any other way to solve "The "XamlCTask" task failed unexpectedly" error without updating xamarin.forms version.
because all the issues arise due to xamarin.forms updation.
In one of other project I am using same xamarin.forms version but it works perfectly. What is actual reason of "XamlC task failed" error?
Although the cause seems different, it looks like it's a known bug. Maybe you could verify that upgrading to the version mentioned in the bug (2.3.5-pre) works for you, and then either disable XAML compilation for the time being, or work with the Xamarin pre-release packages.

error: cannot find symbol method getColor(Context,int) after adding Sugar ORM to project

I would like to use SugarOrm in my app.
If I add the followings:
compile 'com.github.satyan:sugar:1.4'
to the gradle file
and
android:name="com.orm.SugarApp"
to my mainfest's application name
I get the following error on build:
Error:(75, 55) error: cannot find symbol method getColor(Context,int)
at this line:
holder.bg.setBackgroundColor(ContextCompat.getColor(ctx, R.color.primary_move));
If I checkout to a previous version without these 2 lines, my application builds and runds without error.
Any suggestions?
From the Android Documentation:
Helper for accessing features in Context introduced after API level 4
in a backwards compatible fashion.
Do you really need that backward compatibility? Try accesing getColor from the context. You can also still useContext.getColor() while you resolve the main issue however
I have updated to compile 'com.github.satyan:sugar:1.6' and error is gone.

Android Lint limitations?

I recently discovered a fatal error in my android app running on Android version 10 from this line:
((Button)alert.findViewById(android.R.id.button1)).setAllCaps(true);
I have set android:minSdkVersion="9" in AndroidManifest.xml.
The root cause was android.widget.Button inherits from android.widget.TextView and the setAllCaps method was implemented in API level 14.
Reference: https://developer.android.com/reference/android/widget/TextView.html#setAllCaps(boolean)
So my question is why can't I get lint to discover this class of error?
I would presume that lint --check NewApi . would find this kind of issue.
Is it because the dialog which has this button is dynamically created just before this code?
Is there anything I can do to help lint prevent this class of error? In a perfect world I would like warnings to be thrown for any methods called from SDK versions higher than minSdk.

Categories

Resources