xamarin android nuggetPackage dependencies monoAndroid - java

I'm developping a Xamarin Android app and i'm facing a problem which seems to be a problem of nugget package dependencies :
Microsoft.Office365.OAuth.Xamarin V1.0.21
Dependencies :
MonoAndroid, Version v2.2
Xamarin.Android.Support.V4 V23.3
Dependencies :
MonoAndroid, Version v7.0
Whenever I try to build my project :
error: cannot find symbol android.support.v4.content.Loader.OnLoadCanceledListener
This error come from this java file
<%Project%>\obj\Release\android\src\mono\android\support\v4\content\Loader_OnLoadCanceledListenerImplementor.java
package mono.android.support.v4.content;
public class Loader_OnLoadCanceledListenerImplementor
extends java.lang.Object
implements
mono.android.IGCUserPeer,
// this line is making the build fails
android.support.v4.content.Loader.OnLoadCanceledListener
...
...
Morever, these packages work perfectly when they aren't added together.
Am I doing something wrong ?

Related

Custom Capacitor Plugin - add Android dependencies

How can I add an Android build dependency to my custom capacitor plugin for app rate based on
https://developer.android.com/guide/playcore/in-app-review/kotlin-java#java
It fails the build with not finding com.google.android.play.core so I wonder how can I add it as a dependency to the component build?
Below is the error
/AppRate.java:9: error: package com.google.android.play.core.review does not exist
import com.google.android.play.core.review.ReviewInfo;
^
/AppRate.java:10: error: package com.google.android.play.core.review does not exist
import com.google.android.play.core.review.ReviewManager;
^
/AppRate.java:11: error: package com.google.android.play.core.review does not exist
import com.google.android.play.core.review.ReviewManagerFactory;
^
/AppRate.java:12: error: package com.google.android.play.core.tasks does not exist
import com.google.android.play.core.tasks.Task;
^
/AppRate.java:17: error: class AppRate clashes with package of same name
public class AppRate extends Plugin {
^
/AppRate/BuildConfig.java:4: error: package me.url.AppRate clashes with class of same name
package me.url.AppRate;
^
/AppRate.java:21: error: cannot find symbol
Activity activity = this.cordova.getActivity();
I am also not sure about the clash error, but that is a separate topic I guess.
Note - I tried integrating the ionic native plugins but had weird build issues. iOS now works with my custom plugin, fixing Android now.
Try these steps to see:
Delete the Buildconfig.java
Refactor -> Rename, error class.
Build -> Rebuild Project!
--
And if not, share what you have in the file: build.gradle in the defaultConfig section and AndroidManifest from the manifest section.
I had to add
implementation "com.google.android.play:core:1.10.2"
to my build.grade file.

InvalidModuleDescriptorException: Package hellofx.org.openjfx not found in module

Following the JavaFX IntelliJ modular with Gradle tutorial here, I downloaded the project from github and followed the instructions. When I do gradlew run, I get the error:
> Task :run FAILED
Error occurred during initialization of boot layer
java.lang.module.FindException: Error reading module: C:\Users\ANDREW-SL3\github\hellofx\build\classes\java\main
Caused by: java.lang.module.InvalidModuleDescriptorException: Package hellofx.org.openjfx not found in module
Since I made no modification to the project I assume I've done something else wrong but can't figure out what it is.
I have suffered the same problem. I think that it is related to a change in how latest Gradle versions (>= 6.4) treat modules. In my case this post helped me to solve it.
Basically, add this to your build.gradle file:
java {
modularity.inferModulePath.set(true)
}
application {
mainModule = 'hellofx' // name defined in module-info.java
mainClass = 'org.openjfx.MainApp'
}
run {
main = "$moduleName/org.openjfx.MainApp"
}

Gradle - Class not loaded : org.docx4j.jaxb.Context

I had a maven project with old docx4j dependencies, and I wanted to update to java 9. During the update I changed my project from maven to gradle.
So now I have a gradle project in IntelliJ with this dependencies:
dependencies {
implementation('commons-io:commons-io:2.6')
implementation('javax.xml.bind:jaxb-api:2.4.0-b180725.047')
implementation('org.docx4j:docx4j:6.0.1')
implementation('org.docx4j:docx4j-ImportXHTML:6.0.1')
implementation('org.docx4j:docx4j-export-fo:6.0.1')
testImplementation('junit:junit:4.12')
}
The build is working, but if I want to open a .docx file, with Docx4J.load(...) or WordprocessingMLPackage.load(...) it throws a RuntimeException.
In debug mode I can see this message: Class not loaded : org.docx4j.jaxb.Context
This Context.java file has a static code block like this:
static {
...
}
I think it's gradle specific error, because I created a new maven project with the same code and dependencies as the gradle project, and it works.
Is there any solution for this, or should I use maven in the future too?
There is a Gradle-specific answer at https://stackoverflow.com/a/51235096/1031689
Or to "add module" instead, see for example:
https://www.concretepage.com/questions/531
https://github.com/IntershopCommunicationsAG/jaxb-gradle-plugin/issues/11
Or mac java 9 gradle ClassNotFoundException: javax.xml.bind.JAXBElement when building

How to resolve unknown class and can not resolve symbol in Android Studio java library module

Using Android Studio and creating a java library module as part of a sub project I get an error on the following java statement:
javaFile.writeTo(System.out);
and it complains of can not resolve symbol 'writeTo' and unknown class 'System.out'.
Here's the gist of the source code class
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeSpec;
import javax.lang.model.element.Modifier;
public class MyClass {
...
JavaFile javaFile = JavaFile.builder("com.foobar.helloworld", helloWorld)
.build();
javaFile.writeTo(System.out);
}
A bit hard to say without knowing exactly what your exception was, but I had something similar pop up when I was testing out a sub-module annotation processor. When linking the processor to my main module, I was getting a java.lang.NoClassDefFoundError: com/squareup/javapoet/MethodSpec. I was using android-apt to get the annotation processor working, so in my build.config my dependencies had the apt configuration definition:
dependencies {
...
apt 'com.squareup:javapoet:1.7.0' // <- Note that since my Processor used javapoet, I had to include Javapoet in the main module's apt dependency as well as my processor jar
apt files('../processor/build/libs/processor.jar')
}
Once i included the above noted dependency, then all worked fine. Not sure if this applies to your situation without more details, but this got me back on track.

Android Studio : "cannot find symbol" error after adding dependency

I am using the Unity engine to generate an android studio project.
My main project's main activity has the following code in its NativeActivity class:
return mUnityPlayer.injectEvent(event);
Everything compiles and works fine.
However, when I add a certain 3rd party library (androidNative) as a module
I get the following error when I try to compile :
Error:(86, 89) error: cannot find symbol method injectEvent(MotionEvent)
This is surprising, because it is an error in a file from the original project (not the module I added) and I only added a reference.
What is the reason behind this scenario? How can adding a module as a dependency of a project cause a file in the original project to not compile?

Categories

Resources