ambishiva / android-daisy-epub-reader

Automatically exported from code.google.com/p/android-daisy-epub-reader
0 stars 0 forks source link

NewStory: Enhancing the code: Fix the errors and warnings reported by Android Lint #81

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Android Lint reports various errors and warnings about our app. In most cases 
these errors and warnings are worth addressing and we have agreed to clean up 
the app by modifying the code to address the warnings and errors. 

When the warnings are for third-party software such as actionbarsherlock we 
will work with that project to see if they will accept changes and merge them 
into their codebase, rather than patching a local revision of their work.

Our strategy to address the errors and warnings is to address errors first 
(done for our codebase), then each category of warning one-by-one. Our commit 
message should include the command we used to find the category of warning to 
help other people do similar work for their project.

e.g. 

lint --quiet --check HardcodedText . 

Original issue reported on code.google.com by julianharty on 10 Oct 2013 at 8:40

GoogleCodeExporter commented 8 years ago
I check source code by command "lint --check our source". It was show "No 
issues found". Does It mean our project passed Android Lint?.

Original comment by okasuke1...@gmail.com on 11 Oct 2013 at 10:06

Attachments:

GoogleCodeExporter commented 8 years ago
Not quite :)

I get similar results if I specify the full path to the src folder of 
DaisyBookLister i.e. no issues found. However there are Lint issues in the 
project. Instead of using src as a folder, try using the root of the project 
i.e. DaisyBookLister as the target directory (remove \src from your example 
command line). You should then get 14 errors and 3 warnings. (see below from my 
snapshot of your latest changes on 11 Oct 2013)

Here are some suggestions to address the errors: Try moving the extra lines you 
added to the 3 language specific strings.xml from DaisyBookLister. Let's try 
fixing the missing translations for strings in actionbarsherlock in that 
project (or a fork). I think there's some work needed to understand how best to 
fix problems in external Android libraries such as actionbarsherlock. Let's see 
if we can address them in a separate story.

We'll speak on Monday about this. Thanks for making the rest of the 
improvements. 

DaisyBookLister: Error: No .class files were found in project 
"DaisyBookLister", so none of the classfile based checks could be run. Does the 
project need to be built first? [LintError]
/Users/julianharty_air/myopensourceprojects/clean-new-android-daisy-reader/actio
nbarsherlock/res/layout/abs__screen_action_bar.xml:52: Warning: The id 
"abs__split_action_bar" in layout "abs__screen_action_bar" is missing from the 
following layout configurations: layout-xlarge (present in layout) 
[InconsistentLayout]
        android:id="@+id/abs__split_action_bar"
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/julianharty_air/myopensourceprojects/clean-new-android-daisy-reader/actio
nbarsherlock/res/layout/abs__screen_action_bar_overlay.xml:53: Warning: The id 
"abs__split_action_bar" in layout "abs__screen_action_bar_overlay" is missing 
from the following layout configurations: layout-xlarge (present in layout) 
[InconsistentLayout]
    <com.actionbarsherlock.internal.widget.ActionBarContainer android:id="@+id/abs__split_action_bar"
                                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AndroidManifest.xml:7: Warning: Not targeting the latest versions of Android; 
compatibility modes apply. Consider testing and updating this version. Consult 
the android.os.Build.VERSION_CODES javadoc for details. [OldTargetApi]
    <uses-sdk
    ^
res/values-en-rGB/strings.xml:8: Error: "abs__action_bar_home_description" is 
translated here but not found in default locale [ExtraTranslation]
    <string name="abs__action_bar_home_description">Navigate home</string>
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    res/values-ko/strings.xml:86: Also translated here
    res/values-vi/strings.xml:85: Also translated here
res/values-en-rGB/strings.xml:9: Error: "abs__action_bar_up_description" is 
translated here but not found in default locale [ExtraTranslation]
    <string name="abs__action_bar_up_description">Navigate up</string>
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    res/values-ko/strings.xml:87: Also translated here
    res/values-vi/strings.xml:86: Also translated here
res/values-en-rGB/strings.xml:10: Error: 
"abs__action_menu_overflow_description" is translated here but not found in 
default locale [ExtraTranslation]
    <string name="abs__action_menu_overflow_description">More options</string>
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    res/values-ko/strings.xml:88: Also translated here
    res/values-vi/strings.xml:87: Also translated here
res/values-en-rGB/strings.xml:11: Error: "abs__action_mode_done" is translated 
here but not found in default locale [ExtraTranslation]
    <string name="abs__action_mode_done">Done</string>
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    res/values-ko/strings.xml:89: Also translated here
    res/values-vi/strings.xml:88: Also translated here
res/values-en-rGB/strings.xml:12: Error: "abs__activity_chooser_view_see_all" 
is translated here but not found in default locale [ExtraTranslation]
    <string name="abs__activity_chooser_view_see_all">See all…</string>
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    res/values-ko/strings.xml:90: Also translated here
    res/values-vi/strings.xml:89: Also translated here
res/values-en-rGB/strings.xml:13: Error: 
"abs__activitychooserview_choose_application" is translated here but not found 
in default locale [ExtraTranslation]
    <string name="abs__activitychooserview_choose_application">Choose an application</string>
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    res/values-ko/strings.xml:91: Also translated here
    res/values-vi/strings.xml:90: Also translated here
res/values-en-rGB/strings.xml:14: Error: "abs__shareactionprovider_share_with" 
is translated here but not found in default locale [ExtraTranslation]
    <string name="abs__shareactionprovider_share_with">Share with</string>
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    res/values-ko/strings.xml:92: Also translated here
    res/values-vi/strings.xml:91: Also translated here
res/values-en-rGB/strings.xml:15: Error: 
"abs__shareactionprovider_share_with_application" is translated here but not 
found in default locale [ExtraTranslation]
    <string name="abs__shareactionprovider_share_with_application">Share with <xliff:g id="application_name" example="Bluetooth">%s</xliff:g></string>
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    res/values-ko/strings.xml:93: Also translated here
    res/values-vi/strings.xml:92: Also translated here
res/values-en-rGB/strings.xml:16: Error: "abs__searchview_description_search" 
is translated here but not found in default locale [ExtraTranslation]
    <string name="abs__searchview_description_search">Search</string>
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    res/values-ko/strings.xml:94: Also translated here
    res/values-vi/strings.xml:93: Also translated here
res/values-en-rGB/strings.xml:17: Error: "abs__searchview_description_query" is 
translated here but not found in default locale [ExtraTranslation]
    <string name="abs__searchview_description_query">Search query</string>
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    res/values-ko/strings.xml:95: Also translated here
    res/values-vi/strings.xml:94: Also translated here
res/values-en-rGB/strings.xml:18: Error: "abs__searchview_description_clear" is 
translated here but not found in default locale [ExtraTranslation]
    <string name="abs__searchview_description_clear">Clear query</string>
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    res/values-ko/strings.xml:96: Also translated here
    res/values-vi/strings.xml:95: Also translated here
res/values-en-rGB/strings.xml:19: Error: "abs__searchview_description_submit" 
is translated here but not found in default locale [ExtraTranslation]
    <string name="abs__searchview_description_submit">Submit query</string>
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    res/values-ko/strings.xml:97: Also translated here
    res/values-vi/strings.xml:96: Also translated here
res/values-en-rGB/strings.xml:20: Error: "abs__searchview_description_voice" is 
translated here but not found in default locale [ExtraTranslation]
    <string name="abs__searchview_description_voice">Voice search</string>
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    res/values-ko/strings.xml:98: Also translated here
    res/values-vi/strings.xml:97: Also translated here

Original comment by julianharty on 11 Oct 2013 at 9:58

GoogleCodeExporter commented 8 years ago
Here are some useful tips on running Android Lint for projects, including ours, 
that use library projects. 

http://stackoverflow.com/questions/9822019/android-lint-report-for-my-project-on
ly-excluding-library-projects - turn off warnings for the library projects so 
we can focus on the problems in our codebase (first).

http://stackoverflow.com/questions/10260801/actionbarsherlock-gives-tons-of-call
-requires-api-level-11-current-min-is-7/10288804#10288804 to address some of 
the warnings we see. Interestingly ActivityCompat is mentioned in the comments 
as a recommended approach for improving backwards compatibility and the fix for 
the warnings about API versions in ActionBarSherlock. 

Original comment by julianharty on 14 Oct 2013 at 7:24