I am using SLF4J in various java projects, and works great. However I am trying it on android, and I can not make it see the properties file.
According to their instructions, (https://github.com/interdroid/slf4android) I have placed my SLF4J.properties in src/org/slf4j
and have set:
default.log.level=warn
I am checking \bin\classes\org\slf4j, and my file is there.
However I still get my debug log messages. Any ideas?
Found it.
Was using version slf4j-android-1.6.1-RC1.jar
and apparently it is working as described in version 1.6.2 which I compiled from github.
Related
I am trying to upgrade an Android App to build under VS2022 and use the latest nuget packages. I am also trying to modify it so that it will work on phones, and not just tablets, so the display needs to scale properly. (This is an old project that started with VS2010, so there are many legacy problems.)
When I build it, I get the error message:
resource dimen/abc_action_bar_icon_vertical_padding_material not found.
The offending axml code is:
android:textSize="#dimen/abc_action_bar_icon_vertical_padding_material"
I know that this comes from the depreciation of R.dimen and that I should upgrade from the support library to AndroidX. I thought that I had done this.
My question is, How do I fix this? Should I add or delete packages? If I declare the value explicitly, what should I use? This happens in many files, so I want to make sure that it is fixed correctly.
I also get the message:
attribute menu not found
from the code:
app:menu="#menu/navigation_menu"
I assume this is a related problem.
Thanks,
Dan
I integrated a custom lint check as explained here, However the checks have no effects on my test code, it generates errors for the java class inside the main folder but not thetest` folder.
I tried to change Scope.JAVA_FILE_SCOPE to Scope.TEST_SOURCES and other values when creating the com.android.tools.lint.detector.api.Implementation however it did not work.
What am I doing wrong? is that not supported?
It is supported, however this only works reliable with Android Studio Plugin 3.0 and later. Also then you'll need to use the Lint Tools 26.0.0 just to be sure.
I construct my Implementation like this new Implementation(MyDetector.class, EnumSet.of(JAVA_FILE, TEST_SOURCES));
This seems to be a somewhat recent problem, and I am honestly not sure which problem is the real issue. Last week, after updating VS2017 and Android Support Libraries, I started getting the error "java.exe has exited with code 2". After searching, it seemed like the consensus was to enable MultiDex. So I did that, and it worked fine on newer phones. But when I tried to compile on a KitKat phone, I started to get missing class exceptions (but only when I logged with Android Monitor, no exceptions in VS).
I followed this link regarding custom application classes. I am using the correct bat file, and the right custom class. Everything still looks fine on 21+, but the old devices still reports that mono.MonoPackageManager is missing.
When I go look at the multidex.keep generated in my debug folder, mono/MonoPackageManager.class is definitely in that file. So I really have no clue.
I generated an APK in order to inspect it with classyshark. I found a couple of interesting things there. My total number of methods is around 30K, so why is multidex even required if the limit is 65K? And also, I noticed that mono/MonoPackageManager is in classes2.dex, despite it being in my multidex.keep file.
Am I missing something obvious, or are there some major bugs in Xamarin.Android lately?
EDIT: Progress kind of made? Ignoring the fact that my project shouldn't even need multidex, I noticed that the multidex.keep file that was generated was only a single line with no spaces or anything. When I modified this file to put each class on a new line, then added that file with the build action MainDexMainDexList, everything works fine. I did not need to re-add the classes that it was previously complaining about. I have tried multiple versions of android build tools (specifically 25.0.2 and 26.0.1) with the same result. I think it is very strange that adding new lines fixes the issue, but the generated file does not have new lines.
I had the exact same issue and resolved it by creating a custom multidex.keep file in my project root folder and adding the following to it:
mono/MonoPackageManager.class
mono/MonoRuntimeProvider.class
mono/MonoPackageManager_Resources.class
mono/android/app/NotifyTimeZoneChanges.class
mono/android/app/ApplicationRegistration.class
This is in addition to any of my actual application classes it was complaining of not finding during runtime. This solved my <21 problems (especially for KitKat(19)).
The build system still creates a multidex.keep file, but that's in addition to my custom one, so it seems to work for me.
For me was combination of multiple solutions i found over the internets:
multidex.keep file in my project root
mono/android/app/ApplicationRegistration.class
mono/android/app/NotifyTimeZoneChanges.class
mono/MonoRuntimeProvider.class
mono/MonoPackageManager.class
mono/MonoPackageManager_Resources.class
manually add to .csproj to all build options
<AndroidEnableMultipleDex>true</AndroidEnableMultipleDex>
<AndroidEnableMultiDex>true</AndroidEnableMultiDex>
add to AndroidManifest.xml android-name attribute
<application android:name="android.support.multidex.MultiDexApplication">.....</application
in MainApplication class in Android folder add Register attribute
[Application]
[Register("android/support/multidex/MultiDexApplication", DoNotGenerateAcw = true)]
public class MainApplication : Application, Application.IActivityLifecycleCallbacks
{ ... }
Add Name to MainActivity
[Activity(Name = "xx.xxx.MainActivity")]
public class MainActivity :
global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{ ... }
I am using appcenter.ms to build Andriod so change mainDexClasses.bat was NOT good solution. I tried THIS but this broke all other Android versions.
I'm needing help again with my strange projects ;)
So I'm still building a library, and I need to use libA-1.01.jar and libA-2.1.jar
Of course I don't want them in the same flavor, so I used in my gradle file:
flavorACompile files('libs/libA-1.01.jar')
flavorBCompile files('libs/libA-2.1.jar')
This works fine when compiling with gradlew in command line. But the issue is that my classes don't see both libraries. So when I'm coding I can only import the first one (1.01). So I can't use my IDE to code properly I have to guess emacs style if everything is ok and compile to see...
How can I tell Android Studio that the 2 libraries are present? I tried added them both to compile without flavor (just to force android studio to use them) but it didn't work.
I'm sure there is a simple way to do this, but I can't seem to find it :(
Does anyone know where the android compat libary is
located in xmlvm so I could copy it by myself to the project folder because this is
what I guess is missing, also would be provided by target=android-on-iphone but as mentioned below this target isn't available in the current build.
I had absolutely no problem installing xmlvm and getting in touch with the
demo/samples also all the demos worked perfectly for me.
But now im stuck at the last 4 errors in xcode, i migrated my android project via --
skeleton=android:migrate then cross-compiled it via --target=iphone and opened
up the project in Xcode. after few project setup changes the errors went down from
72 to 4 errors ;)
however the errors are importing file not found errors of compat libs, so this
should somehow get to be solved i think...
is it because --target=android-on-iphone wasnt used by me because this option
will copy the android compat libary to the project folder.. well i tried to use this
target mentioned in 2 documentations of xmlvm but in the actual build of xmlvm
this target however does not exist..
How to solve these errors?
Screenshots:
http://img526.imageshack.us/img526/8957/bildschirmfoto20120620u.png
http://imageshack.us/f/138/bildschirmfoto20120620u.png/
From what I can see, it looks like you are using part of the Android API which is not yet implemented.
Unfortunately it seems that you either need to rewrite your application or implement the API yourself.