-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'DownloadDrawablesAsync' does not implement inherited abstract member 'AsyncTask.DoInBackground(params Object[])' #647
Comments
@fernandovm In your case you are inheriting a type and binding generator generates code w/o compiling (or even better semantically analysing the code), so the only way is to tweak class inheritance (metadata) with metadata transforms in metadata.xml:
So that method was generated:
So why does it not build? Because Mopub version returns So if add this to your
It should have the same signature as method in the base class, but the error persists. This will make your code build (at least it did in my code):
I will create repro sample in the repo and post it here. |
I managed to bind v.5.4.1 without any metadata. There is something in v.5.12.0 OK mvnrepository does not have the latest version, but bintray: https://bintray.com/mopub/mopub-android-sdk/mopub-android-sdk/_latestVersion 5.12.0 builds w/o issues and metadata too https://github.com/HolisticWare/HolisticWareComponents/tree/master/XPlat/Mopub Seems that new and old style projects (and tooling) do make the difference: |
I'm not sure why
That's generally frowned upon as it messes with the type that gets sent to Java, so you will need to test it before you ship it. (This is effectively what @moljac's |
For internal investigation: There's 2 issues with what gets generated for
|
It's not good enough because |
The problem with the "just change the The result will be Java Callable Wrapper generator errors from |
What we need is a (not fully specified or thought-out) For example, if there was an implicit conversion from partial class /* Java.Lang */ Object {
public static implicit operator Java.Lang.Object (IDictionary value) => new JavaDictionary (value);
// ...
} While this "works," is this something we want to support? (Though Alternatively, could we allow return JavaDictionary<string, Drawable>.FromJniHandle (__rm.Handle, JniHandleOwnership.TransferLocalRef)
.JavaCast<Java.Lang.Object> (); Though as-is, this would also require some additional "glue code" to add a new |
@moljac The thing is your All It just happens to be a successful change that doesn't fix the issue. 😄 |
Hi @moljac, @jpobst and @jonpryor.. Then, I didn't go as far as you guys, but I have made some tries using the guide on https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb before post the issue. My difficulties and points of attention were:
|
One thing to try would be use @moljac's Then manually bind it in an
This is the generated code, with the following changes:
Note this is untested, you should ensure it actually works. |
Hi @jpobst, I already have applied the @moljac's suggestion and I'm trying to test, but now I have another issue. The MoPub's SDK is needed, together with google mediation mopub adapter, to try the AdMob mediation. However, when I build a binding project to MoPub's SDK (https://bintray.com/mopub/mopub-android-sdk/mopub-android-sdk/5.12.0) it does not import/generate any class.. :( |
If you run Rebuild, what messages are you seeing in the log? There's generally pretty good warnings telling you exactly why it is skipping over each type/method it doesn't bind. |
Hi @jpobst, yes, generally, but unfortunately seems is not be this case. In normal output msbuild verbosity is generated just one: warning CS0109: The member 'BuildConfig.class_ref' does not hide an accessible member. The new keyword is not required. The diagnostico verbosity output log: build-output.txt |
Are the types listed in:
These are the output as the process moves through in order (parsing the jar, resolving the java types, applying metadata), so if we can find where the types disappear it should tell us what step is failing. If they aren't in any of the files, you can use a Java decompiler to see if they exist in the .jar: |
Hi guys, excuse me by delay in reply. So @jpobst, indeed, I don't know why (maybe it is just some kind of gradle wrapper), but the mopub android sdk .aar file downloaded from bintray does not has the need classes inside the classes.jar file. Well, I built the mopub android sdk from github sources and create a binding library from the .jar generated file. Several adjustments were needed in metadata file to build with succesfull, but okay, it worked. However, when I add a reference to this binding library in my android app project I have new compilation errors, such as:
So, the main problem is that in generated file from obj\Debug\generated\src the interface already appears as public: // Metadata.xml XPath class reference: path="/api/package[@name='com.mopub.mobileads']/class[@name='VideoDownloader']"
[global::Android.Runtime.Register ("com/mopub/mobileads/VideoDownloader", DoNotGenerateAcw=true)]
public partial class VideoDownloader : global::Java.Lang.Object {
// Metadata.xml XPath interface reference: path="/api/package[@name='com.mopub.mobileads']/interface[@name='VideoDownloader.VideoDownloaderListener']"
[Register ("com/mopub/mobileads/VideoDownloader$VideoDownloaderListener", "", "Com.Mopub.Mobileads.VideoDownloader/IVideoDownloaderListenerInvoker")]
public partial interface IVideoDownloaderListener : IJavaObject, IJavaPeerable {
// Metadata.xml XPath method reference: path="/api/package[@name='com.mopub.mobileads']/interface[@name='VideoDownloader.VideoDownloaderListener']/method[@name='onComplete' and count(parameter)=1 and parameter[1][@type='boolean']]"
[Register ("onComplete", "(Z)V", "GetOnComplete_ZHandler:Com.Mopub.Mobileads.VideoDownloader/IVideoDownloaderListenerInvoker, Higgx.Library.AdSource.Mopub.Sdk.Android")]
void OnComplete (bool p0);
}
//removed code..
} Would appreciate if you point to me what's the problem that I can't see. :(( Thank you! |
That error is coming from Java, not C#. So you'll need to look at the Since you do this to change the C# version I suspect it is not public in Java:
I'm not sure how you're intended to implement that interface, even if you were consuming this directly from Java, if it's not public. |
Hi @jpobst, this change in C# was just a test (one of them), but yes, it is not public in Java (see here), it is visible only inside its package. The problem seems me is that in binding library it is generated as public, but, even I changing that using metatada (to force the internal visibility) I get erros when compiling my app that reference this binding library. |
I'm afraid I don't understand what you are saying, it is explicitly being marked
What error do you get when you remove that? |
Ok, sorry, let's go.. The interface VideoDownloaderListener is not public in the java code, but I get the error described above, even without to do any visibility change in the metadata. Then, I have made several tests changing the visibility of this interface using metadata, just attempts to try understand how the generator would can interpret the case, but, I was not successful. You can see this problem in the updated sample project Google.Ads.Mediation.Mopub.zip. |
When I compile the sample project using VS2019 16.6.0 I get:
This is because However this does not seem to be the error you are getting. Is this an error you have gotten previously and have a workaround for? |
When I compile it I also get this error, in really, I get seven errors: I didn't mentioned before because I wanted solve the other six problems, they seems me the same thing. About |
I think those 6 will go away if you update to 16.6+, due to this change: #572. Granted, the fix is that the listeners are going to go away, but they are package-private in Java, and shouldn't be bound. That only leaves the error I mentioned. |
Indeed, great!
I will remove the MraidBridge class using metadata and to test at runtime.
|
Hopefully this fixed your issue! If not, please comment with updated details and we can re-open. |
When I try compile a binding to google mediation mopub adapter I get the error 'DownloadDrawablesAsync' does not implement inherited abstract member 'AsyncTask.DoInBackground(params Object[])'
Steps to Reproduce
Expected Behavior
A successful build.
Actual Behavior
1>C:\Users\fernando\source\repos\Google.Ads.Mediation.Mopub\Google.Ads.Mediation.Mopub\obj\Debug\generated\src\Com.Mopub.Mobileads.Dfp.Adapters.DownloadDrawablesAsync.cs(10,23,10,45): error CS0534: 'DownloadDrawablesAsync' does not implement inherited abstract member 'AsyncTask.DoInBackground(params Object[])'
Version Information
Microsoft Visual Studio Enterprise 2019
Version 16.5.5
VisualStudio.16.Release/16.5.5+30104.148
Microsoft .NET Framework
Version 4.8.03752
Installed Version: Enterprise
Xamarin 16.5.000.533 (d16-5@9152e1b)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 16.5.0.470 (remotes/origin/d16-5@681de3fd6)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 16.5.49 (0904f41)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 10.2.0.100 (d16-5/988c811)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: c0c5c78
Java.Interop: xamarin/java.interop/d16-5@fc18c54
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@46204c4
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-5@9f4ed4b
Xamarin.iOS and Xamarin.Mac SDK 13.16.0.13 (b75deaf)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
The text was updated successfully, but these errors were encountered: