I followed this tutorial and it worked perfect for me. Now I want to add fix issue functionality. I am using Eclipse.
In Lint Warnings view we have Fix button, can I handle it?
For example when we have hard coded string (android:text="Test") in TextView when you click CTRL + 1, help pop up opens with possibility to Extract String. What I am trying to do is to add extract hard coded dp values functionality.
Also it would be great if you could point me where I could find source code of already implemented lint issues.
Thank You.
Lint checks can be written standalone:
Writing a Lint check: http://tools.android.com/tips/lint/writing-a-lint-check
Lint checks source: https://android.googlesource.com/platform/tools/base/+/master/lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks
Lint fixes are part of the ADT pluggin: http://tools.android.com/tips/lint
Lint is integrated with ADT 16 and later. The integration offers a few features above the command line version of lint:
Automatic fixes for many warnings
Lint gets run automatically on various editing operations
Ability to suppress types of errors as well as specific instances of an error
Ability to configure issue severities
Jump directly to the problem source from the lint view
Consider making a plugin for your Custom lint check in IntelliJ Idea Community edition, downloaded from https://www.jetbrains.com/idea/download/, and follow the tutorial at http://www.jetbrains.org/intellij/sdk/docs/index.html.
After then you will come to know that to handle light bulb for the fix of your custom Lint warning you have to extend the IntentionAction class particularly.
And then search for deploying the plugin in the tutorial and finally you will come to know to put the jar of the plugin thus created in the Android Studio/Contents/plugins folder.
Related
The wise ones suggest dramatic solutions. Is there any harm happening? can I hope that it will recover all by itself. Is this a "cloud no bigger than a man's hand" coming to engulf my project in a terrible storm?
There are 3 cases that i can think about :
1)You have got some kind or warning for example :
Lets say that you are using google maps and want to add "current location button" - if you wont check if the user accepted location permission or not you will be able to run your app but you will have a warning in red line.
2)If some view is marked in red but everything compile with no errors , this is some error and cleaning and rebuilding your project should fix this
3)If some file name is marked as red , there may be some error/warning inside that file itself(for example - XML error inside some layout that allow yo to compile your app)
#user462990 If you can't see any obvious issues. I'd suggest the static analyzer Lint tool. It inspects your code and would give you a detailed report of all issues wrong with your project.
Just go to Analyze->Inspect Code.
In the Specify Inspection Scope dialog that appears select Whole project.
Lint inspects your code without building it and gives you a report of all the issues in the Inspection Result tool window at the bottom.
Clicking on any of those issues takes you to the editor at the exact line of code where the issue occurred.
See below captain Lint reporting for duty 💪.
What's the problem...
It's the color of the "R" now it's red, it was . always black before.
I compressed the project and re-opened it again and the viewPager which was red is now black.
Visual Studio 2015, Update 3.
Create a blank solution. Choose Add New Project -> Visual F# -> Android.
Create either a Blank App (Android) or a Unit Test App (Android).
The app is created successfully.
Right click on References, and choose "Add Reference". The following dialog box pops up:
Note that when you look at the Project Properties, there are two "Application" tabs. The second one generates an error:
Once the project has been unloaded, it can no longer be reloaded. The resulting error message is:
I have reported this on the Xamarin Forums, but the process is slow. I'd like to find a workaround, but I'm fumbling in the dark. Once I've unloaded the fsproj file, I can't find any mention of "frameworkName", and I can't reload it either.
My Android settings appear to all be up to date:
Does anyone know of any workarounds that will allow me to start unit testing my existing app?
I believe I have a fix for this issue :)
Xamarin expects F# 3.x to be present, which at this point must be manually added. You should be able to download F# 3.x here
Please let me know if this fixes the issue for you.
Thanks!
Edit: I have filed the following bug as well: https://bugzilla.xamarin.com/show_bug.cgi?id=42970
I am a complete newbie who has just about started android app. development using Xamarin Forms and VS2012. Only about 20-21 days of exposure I have got. I am trying to learn along the way through writing an imaginary practice app. But there are some errors I am getting. You can see them in the picture.
http://imagebin.ca/v/29PeHoLhwW1i
Can someone direct me what exactly it is saying and what I need to do in order to rectify them?Is there something wrong with the installation/environment or like some update? Or is it something else? What's with the "unzipping failed" message?
Some one kindly help me out here please. Facing great deal of difficulty in tackling this.
Many Thanks in advance.
As the error message says (see the third error message ), you need to install the "Android Support Repository" from the Android SDK manager.
The errors are telling you that Xamarin is looking for the support library, but that it cannot find the support library and thus the build failed.
#Tanis.7x and #Jason.
Just an update I want to post:
I went about reproducing this scenario: creating a new project, do some primary simple code, add 1,2 layouts et all. When I build the new project, these 9 errors don't appear. This is strange to me. Because: this is exactly what had happened to my main work also. These errors were not there. Something, somewhere happened along the line, due to which they started appearing suddenly; out of the blue. I remember, I had updated Xamarin version, also just added some packages like JSON.Net and it is only after that this error list appeared. Not before that, if I remember correctly. Which is weird to me. If you try to recreate by creating a brand new project these 9 errors won't appear. I tried recreating this twice; no errors.
Yes, I'm manually downloading the zip file. Hopefully this makes the compiler happy. I'll keep posted about the updates.
Thanks All!
since I updated my Android SDK today I get some strange Lint errors in my project. The activity contains amongst others a textview. Everything works fine, but if I want to change the text size of the view within the code with .setTextSize(float size), I get in other lines (and also other independent methods) errors that a call requires a certain API level. But that are calls like string.isEmpty(), which is available since API level 1.
What am I missing? And I know, I can set the text size also in the xml-file, but I want to change it during runtime.
Any ideas?
Thanks!
Best regards
Tobi
I think I got into something similar some time ago (nonsense Lint errors)...
Are you working with Eclipse?
If so, you can try the following:
Restart Eclipse
Clean your project (Project->clean...)
Click the button "Runs Android Lint..." (it's in the toolbar, between the "Virtual device manager" and the "new project wizard")
I don't remember exactly what did I do to solve the problem, I hope it works though
Good luck!
With the latest release, I've had a few times where the lint errors were just incorrect. (missing semicolon on a line with a semicolon, etc).
In such cases, you can right-click on lint error warning, or on the numberings on the left side, and select "Clear All Lint Markers".
This will allow you to compile the file once, and if that works, Lint seems to start acting normally again.
Every One Here
When i update my ADT plugin to ADT 16 i get One new (Tool)thing which is run android Lint when i run it after select my android project it give me more 550 warning related to project for android .should i have to follow advise by Lint for my resource like String.xml and some of layout use in my activity .
For Knowing more about Lint i refer this tips here is Click here
It also Give me Warning Like Below :
Hardcoded string "AnyThing", should use #string resource
So what i think is Lint will help for resource problem in android.
If you have more thing about android lint then let me known .
and what should i do will This xml for lint and where should i put this xml in project root or any other directory.
<?xml version="1.0" encoding="UTF-8"?>
<lint>
</lint>
and i also getting This Warning "[Accessibility] missing contentDescription attribute on image" for ImageView. while using android lint
I think by giving following things like below To Images:
android:contentDescription="#string/desc"
This defines text that briefly describes content of the view. This property is used primarily for accessibility. Since some views do not have textual representation this attribute can be used for providing such.
Non-textual widgets like ImageViews and ImageButtons should use the contentDescription attribute to specify a textual description of the widget such that screen readers and other accessibility tools can adequately describe the user interface.
I've tried lint just for fun. What I can say. It's a type of static analysis tool that is developed specifically for Android. Thus, a developer of Android applications can run automatic static tests across his/her code.
You can run lint in Eclipse simply pressing on button in the panel (this button in my case is near the button of AVD Manager. After that Eclipse opens a window where all violations of lint rules are displayed. You can double click on the error and correct it. As a static analysis tool it can have false positives.
The lint tool has been already supplied with the number of embedded rules. You can read about them on this lint page.
As for lint xml file, I don't know what to do with it.