Custom lint check for tests files - android

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));

Related

Android: Using several version of the same library for different flavors

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 :(

Android Studio (0.8.1) cant use go to declaration/implementation

I cant seem to use go to declaration or implementation for any classes and methods that are outside of either the current class/file. It will work for classes that are from the android library but nothing that I created or that I import from another library. This is taking a huge toll on productivity... Anyone run into this? Have a solution? Ideas for a fix?
Also highlighting seems to be an issue as well, this might be related. It seems lighter then it used to be, like Annotations are not being highlighted. Maybe its a parser issue?
If you are using gradle to build your application, then make sure gradle project sync is not failing. If gradle project sync fails, then basic IDE functionality may not work properly e.g. goto type declaration (ctrl+shift+b) and implementation (ctrl+alt+b or ctrl+click). Android studio also does a wonderful job of notifying you when something fails.

SLF4J.properties make it work in android

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.

xmlvm - import errors compat libs in xcode

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.

Referencing Android custom library cause runtime class not found error in Application

I am working on a custom Android library. I start off with a java project (in Eclipse) with another UI testing Android project.
In my UI testing project, I reference the library project in build path, and everything is good and I can test the library codes in the UI.
Later on, I decided I need to have the 'Gen' code (for custom styles attributes), so I try to change my library to an Android project (via Android-tools -> convert.. ), and disasters happens! After fixing up all the compile time problems, it finally 'let' me start the UI testing application, and bangs! When I try to create any objects from the library class, it said (in the Log) that Class not found.
Two questions:
Any idea how to fix this? I tried but seems it is for referencing another .apk that need to install separately.
If I just keep it to be java project (not android) for my library, can I use the resource generator? and how?
PS: the dependency (my library) is installed before the UI test application, according to the Console of Eclipse said.
Update: I tried to compile the library project to jar and reference it from the UI testing, and in this way, it works. But I don't want to use this approach since it is very slow in terms of testing.
for those who are doing same mistake like me
when library project is an android project
got to
properties > android > click add button at bottom of the popup inside
library section
and add project, instead of
properties > java build path > project > add
later approach is for pure java projects only .
Finally I found the answer to my own question. This is actually mentioned in official documentation.

Categories

Resources