2015-05-20 7 views
34

Я пытаюсь опубликовать мое приложение Android, следуя инструкциям здесь:Ошибка при запуске Cordova построить -release андроид

http://ionicframework.com/docs/guide/publishing.html

Однако, когда я бегу Cordova построить --release андроида я получаю следующее ошибка:

:lintVitalArmv7Release 
/Users/xxx/Documents/xxx/xxx/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/xxx/Documents/xxx/xxx/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">myapp</string> 
      ~~~~~~~~~~~~~~~ 
/Users/xxx/Documents/xxx/xxx/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/xxx/Documents/xxx/xxx/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/xxx/Documents/xxx/xxx/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> 
    5 errors, 0 warnings 
    :lintVitalArmv7Release FAILED 

    FAILURE: Build failed with an exception. 

    * What went wrong: 
    Execution failed for task ':lintVitalArmv7Release'. 
    > 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: 4.583 secs 

    /Users/xxx/Documents/xxx/xxx/platforms/android/cordova/node_modules/q/q.js:126 
         throw e; 
          ^
    Error code 1 for command: /Users/xxx/Documents/xxx/xxx/platforms/android/gradlew with args: cdvBuildRelease,-b,/Users/xxx/Documents/xxx/xxx/platforms/android/build.gradle,-Dorg.gradle.daemon=true 
    ERROR building one of the platforms: Error: /Users/xxx/Documents/xxx/xxx/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/xxx/Documents/xxx/xxx/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) 

Я могу запустить ионный сборщик и развернуть эмулятор без проблем.

Я попытался найти lintOptions и build.gradle, но я не могу найти их в любом месте в моем проекте ...

Может кто-нибудь помочь? Заранее спасибо

+0

Вы должны найти 'build.gradle' в'/platform/android/'. Попробуйте добавить предлагаемый вариант и повторно запустить. – QueryLars

+0

У меня такая же проблема здесь ... Любая идея, что происходит? –

+0

Если ниже решения не работают, проверьте http://stackoverflow.com/questions/17020298/android-sdks-build-tools-17-0-0-aapt-error-while-loading-shared-libraries-libz –

ответ

39

решаемые путем добавления

lintOptions { 
    abortOnError false 
} 

раздел android {} в /platforms/android/build.gradle

+0

Оцените это сэр. – cpk

+18

еще лучше, а не редактирование 'build.grade', добавить новый файл с именем' сборки-extras.gradle' и поместите в: 'андроида { lintOptions { checkReleaseBuilds ложных } }' – DenisH

+0

Dont есть слова чтобы оценить моего друга .. Большое спасибо – Vinith

7

One может быть более конкретным, просто добавив

lintOptions { 
    disable MissingTranslation 
} 
+10

я обнаружил, что нужно добавить 'lintOptions { отключить«MissingTranslation» отключить«ExtraTranslation» }' (на отдельных строках, очевидно) – DenisH

+0

Это кажется мне лучше: Lint может быть полезным для других вещей. –

30

Мое обновление build.gradle до

android { 
    lintOptions { disable 'MissingTranslation', 'ExtraTranslation' } 
} 

работал.

+0

Спасибо, помощник .. это сэкономит мне много времени. –

+1

Гораздо лучший вариант, чем полностью отключение проверки ошибок – andreszs

+0

Спасибо большое, это помогло .. Это сработало! но надеюсь, что это не повлияет ни на что другое и надежное решение: P – idleMind

2
echo "android { lintOptions { checkReleaseBuilds false } }" >> platforms/android/build-extras.gradle 
4

На стационарную этой ошибки следует добавить

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 
} 

В андроида разделе {} в /platforms/android/build.gradle

14

Для тех, кто предпочитает держать platforms каталог из ряда VCS (Git и т. Д.),
лучшим решением на данный момент является использование плагина под названием ignore-lint-translation.

cordova plugin add cordova-plugin-ignore-lint-translation --save 

Эффективным результатом является добавление файла градиента, который отключит такие параметры линта (doh!).

+0

спасибо, это именно то, что я был ищет – rarspace01

+0

Кордова поддерживает build-extras.gradle, это не нужно втягивать в собственный файл, просто скопируйте build-extras.gradle в каталог платформы. Это совет, который наиболее легко доступен в документации. –

Смежные вопросы