Can't build android project after using phonegap-plugin-barcodescanner


#1

Hey, I got an error after add phonegap-plugin-barcodescanner plugin in my project.

I have down this:

ionic start testbarcode tabs
cd testbarcode/
ionic platform add android
cordova build --release android

It seems wright, but after add the plugin:

cordova plugin add https://github.com/phonegap/phonegap-plugin-barcodescanner.git

and then build android release:

cordova build --release android

I got the error:

$ cordova build --release android
Running command: /Users/V/work/ionic/testbarcode/hooks/after_prepare/010_add_platform_class.js /Users/V/work/ionic/testbarcode
add to body class: platform-android
Running command: /Users/V/work/ionic/testbarcode/platforms/android/cordova/build --release
ANDROID_HOME=/Users/V/work/android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
Running: /Users/V/work/ionic/testbarcode/platforms/android/gradlew cdvBuildRelease -b /Users/V/work/ionic/testbarcode/platforms/android/build.gradle -Dorg.gradle.daemon=true
:preBuild
:preReleaseBuild
:checkReleaseManifest
:CordovaLib:compileLint
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
:CordovaLib:preBuild
:CordovaLib:preReleaseBuild
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl UP-TO-DATE
:CordovaLib:compileReleaseRenderscript UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig UP-TO-DATE
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets UP-TO-DATE
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources UP-TO-DATE
:CordovaLib:processReleaseManifest UP-TO-DATE
:CordovaLib:processReleaseResources UP-TO-DATE
:CordovaLib:generateReleaseSources UP-TO-DATE
:CordovaLib:compileReleaseJava UP-TO-DATE
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:packageReleaseJar UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:packageReleaseJniLibs UP-TO-DATE
:CordovaLib:packageReleaseLocalJar UP-TO-DATE
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:bundleRelease UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedReleaseLibrary UP-TO-DATE
:prepareReleaseDependencies
:compileReleaseAidl UP-TO-DATE
:compileReleaseRenderscript UP-TO-DATE
:generateReleaseBuildConfig UP-TO-DATE
:generateReleaseAssets UP-TO-DATE
:mergeReleaseAssets UP-TO-DATE
:generateReleaseResValues UP-TO-DATE
:generateReleaseResources UP-TO-DATE
:mergeReleaseResources UP-TO-DATE
:processReleaseManifest UP-TO-DATE
:processReleaseResources UP-TO-DATE
:generateReleaseSources UP-TO-DATE
:compileReleaseJava UP-TO-DATE
:lintVitalRelease
/Users/V/work/ionic/testbarcode/platforms/android/res/values/arrays.xml:3: Error: "country_codes" is not translated in "ar" (Arabic), "bg" (Bulgarian), "ca" (Catalan), "cs" (Czech), "da" (Danish), "de" (German), "el" (Greek), "es" (Spanish), "eu" (Basque), "fi" (Finnish), "fr" (French), "he" (Hebrew), "hi" (Hindi), "hu" (Hungarian), "id" (Indonesian), "it" (Italian), "iw" (Hebrew), "ja" (Japanese), "ko" (Korean), "nl" (Dutch), "pl" (Polish), "pt" (Portuguese), "ru" (Russian), "sk" (Slovak), "sl" (Slovene), "sv" (Swedish), "tr" (Turkish), "zh-rCN" (Chinese: China), "zh-rTW" (Chinese: Taiwan, Province of China) [MissingTranslation]
  <string-array name="country_codes">
                ~~~~~~~~~~~~~~~~~~~~
/Users/V/work/ionic/testbarcode/platforms/android/res/values/strings.xml:3: Error: "app_name" is not translated in "ar" (Arabic), "bg" (Bulgarian), "ca" (Catalan), "cs" (Czech), "da" (Danish), "de" (German), "el" (Greek), "es" (Spanish), "eu" (Basque), "fi" (Finnish), "fr" (French), "he" (Hebrew), "hi" (Hindi), "hu" (Hungarian), "id" (Indonesian), "it" (Italian), "iw" (Hebrew), "ja" (Japanese), "ko" (Korean), "nl" (Dutch), "pl" (Polish), "pt" (Portuguese), "ru" (Russian), "sk" (Slovak), "sl" (Slovene), "sv" (Swedish), "tr" (Turkish), "zh-rCN" (Chinese: China), "zh-rTW" (Chinese: Taiwan, Province of China) [MissingTranslation]
    <string name="app_name">testbarcode</string>
            ~~~~~~~~~~~~~~~
/Users/V/work/ionic/testbarcode/platforms/android/res/values/strings.xml:4: Error: "launcher_name" is not translated in "ar" (Arabic), "bg" (Bulgarian), "ca" (Catalan), "cs" (Czech), "da" (Danish), "de" (German), "el" (Greek), "es" (Spanish), "eu" (Basque), "fi" (Finnish), "fr" (French), "he" (Hebrew), "hi" (Hindi), "hu" (Hungarian), "id" (Indonesian), "it" (Italian), "iw" (Hebrew), "ja" (Japanese), "ko" (Korean), "nl" (Dutch), "pl" (Polish), "pt" (Portuguese), "ru" (Russian), "sk" (Slovak), "sl" (Slovene), "sv" (Swedish), "tr" (Turkish), "zh-rCN" (Chinese: China), "zh-rTW" (Chinese: Taiwan, Province of China) [MissingTranslation]
    <string name="launcher_name">@string/app_name</string>
            ~~~~~~~~~~~~~~~~~~~~
/Users/V/work/ionic/testbarcode/platforms/android/res/values/strings.xml:5: Error: "activity_name" is not translated in "ar" (Arabic), "bg" (Bulgarian), "ca" (Catalan), "cs" (Czech), "da" (Danish), "de" (German), "el" (Greek), "es" (Spanish), "eu" (Basque), "fi" (Finnish), "fr" (French), "he" (Hebrew), "hi" (Hindi), "hu" (Hungarian), "id" (Indonesian), "it" (Italian), "iw" (Hebrew), "ja" (Japanese), "ko" (Korean), "nl" (Dutch), "pl" (Polish), "pt" (Portuguese), "ru" (Russian), "sk" (Slovak), "sl" (Slovene), "sv" (Swedish), "tr" (Turkish), "zh-rCN" (Chinese: China), "zh-rTW" (Chinese: Taiwan, Province of China) [MissingTranslation]
    <string name="activity_name">@string/launcher_name</string>
            ~~~~~~~~~~~~~~~~~~~~

   Explanation for issues of type "MissingTranslation":
   If an application has more than one locale, then all the strings declared
   in one language should also be translated in all other languages.

   If the string should not be translated, you can add the attribute
   translatable="false" on the <string> element, or you can define all your
   non-translatable strings in a resource file called donottranslate.xml. Or,
   you can ignore the issue with a tools:ignore="MissingTranslation"
   attribute.

   By default this detector allows regions of a language to just provide a
   subset of the strings and fall back to the standard language strings. You
   can require all regions to provide a full translation by setting the
   environment variable ANDROID_LINT_COMPLETE_REGIONS.

   You can tell lint (and other tools) which language is the default language
   in your res/values/ folder by specifying tools:locale="languageCode" for
   the root <resources> element in your resource file. (The tools prefix
   refers to the namespace declaration http://schemas.android.com/tools.)

/Users/V/work/ionic/testbarcode/platforms/android/res/values-ar/strings.xml:64: Error: "menu_settings" is translated here but not found in default locale [ExtraTranslation]
  <string name="menu_settings">إعدادات</string>
          ~~~~~~~~~~~~~~~~~~~~
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-bg/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-ca/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-cs/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-da/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-de/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-el/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-es/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-eu/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-fi/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-fr/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-he/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-hi/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-hu/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-id/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-it/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-iw/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-ja/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-ko/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-nl/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-pl/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-pt/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-ru/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-sk/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-sl/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-sv/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-tr/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-zh-rCN/strings.xml:64: Also translated here
    /Users/V/work/ionic/testbarcode/platforms/android/res/values-zh-rTW/strings.xml:64: Also translated here

   Explanation for issues of type "ExtraTranslation":
   If a string appears in a specific language translation file, but there is
   no corresponding string in the default locale, then this string is probably
   unused. (It's technically possible that your application is only intended
   to run in a specific locale, but it's still a good idea to provide a
   fallback.).

   Note that these strings can lead to crashes if the string is looked up on
   any locale not providing a translation, so it's important to clean them
   up.

5 errors, 0 warnings
:lintVitalRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':lintVitalRelease'.
> Lint found fatal errors while assembling a release target.
  
  To proceed, either fix the issues identified by lint, or modify your build script as follows:
  ...
  android {
      lintOptions {
          checkReleaseBuilds false
          // Or, if you prefer, you can continue to check for errors in release builds,
          // but continue the build even when errors are found:
          abortOnError false
      }
  }
  ...

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3.242 secs

/Users/V/work/ionic/testbarcode/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: /Users/V/work/ionic/testbarcode/platforms/android/gradlew with args: cdvBuildRelease,-b,/Users/V/work/ionic/testbarcode/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/V/work/ionic/testbarcode/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /Users/V/work/ionic/testbarcode/platforms/android/cordova/build: Command failed with exit code 8
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:766:16)
    at Process.ChildProcess._handle.onexit (child_process.js:833:5)

Does anyone know where I was wrong? or what I should do to fix this?

Thank you very much!


#2

@max @mhartington @perry
Sorry, but it has troubled me for a long time, so can you help me?


#3

Hi,

The answer is actually in the error message:

android {
      lintOptions {
          checkReleaseBuilds false
          // Or, if you prefer, you can continue to check for errors in release builds,
          // but continue the build even when errors are found:
          abortOnError false
      }
  }

I found the same question already being asked on Stackoverflow:
http://stackoverflow.com/questions/30345879/error-when-running-cordova-build-release-android


#4

Excelente Sussefully