更新为 Android gradle plugin 3.0.0
和gradle 4.1
后,我无法编译代码。该项目在2.3.3中运行良好。
使用--stacktrace
运行gradle时出现错误:
错误:com.android.builder.symbols.ResourceDirectoryParseException: 无法解析XML资源文件 '/Users/felipea/Documents/next-components/nextcomponents/build/intermediates/bundles/debug/res/values/values.xml' 错误:java.lang.IllegalArgumentException:错误:''无效 资源名称字符错误:错误:''不是有效的资源名称 字符
但是我没有在我的values.xml中找到空格字符:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="months_of_year">
<item>JANEIRO</item>
<item>FEVEREIRO</item>
<item>MARÇO</item>
<item>ABRIL</item>
<item>MAIO</item>
<item>JUNHO</item>
<item>JULHO</item>
<item>AGOSTO</item>
<item>SETEMBRO</item>
<item>OUTUBRO</item>
<item>NOVEMBRO</item>
<item>DEZEMBRO</item>
</string-array>
<attr format="boolean" name="autoSpace"/>
<attr format="reference" name="calendarDaysOfWeekListStyle"/>
<attr format="reference" name="calendarItemStyle"/>
<attr format="color" name="calendarSelectedDayColor"/>
<attr format="reference" name="calendarStyle"/>
<attr format="reference" name="calendarTextHeaderStyle"/>
<attr format="color" name="calendarUnselectedDayColor"/>
<attr format="integer" name="circumference"/>
<attr format="integer" name="dividerColor"/>
<attr format="boolean" name="hasImageInfo"/>
<attr format="reference" name="imageInfoDrawable"/>
<attr format="reference" name="tollBarCheckIcon"/>
<attr format="reference" name="tollBarCloseIcon"/>
<color name="color_edittext_error">#ff3333</color>
<color name="green_light">#01ff5f</color>
<color name="next_black_1">#000000</color>
<color name="next_black_1_10">#1A000000</color>
<color name="next_black_2">#1e1e1e</color>
<color name="next_black_3">#202020</color>
<color name="next_black_4">#333333</color>
<color name="next_gray_1">#585858</color>
<color name="next_gray_2">#808285</color>
<color name="next_gray_3">#B8B8B8</color>
<color name="next_gray_4">#E9E9E9</color>
<color name="next_gray_5">#EFEFEF</color>
<color name="next_gray_6">#F5F5F5</color>
<color name="next_green">#01ff5f</color>
<color name="next_green_1">#00581B</color>
<color name="next_green_2">#01B240</color>
<color name="next_green_3">#01DF53</color>
<color name="next_green_4">#01F85C</color>
<color name="next_green_5">#01FF5F</color>
<color name="next_green_6">#00FFA2</color>
<color name="next_grey">#E9E9E9</color>
<color name="next_red_1">#FE7059</color>
<color name="next_transparent">#FFFFFFFF</color>
<color name="next_white_1">#ffffff</color>
<color name="next_yellow_1">#CCB80C</color>
<color name="next_yellow_2">#FFE60F</color>
<declare-styleable name="AnimatedIcon"><attr format="boolean" name="isDark"/><attr format="color" name="iconStrokeColor"/><attr format="dimension" name="iconStrokeWidth"/></declare-styleable>
<declare-styleable name="MaskableLayout"><attr format="reference" name="mask"/><attr name="porterduffxfermode">
<enum name="ADD" value="0"/>
<enum name="CLEAR" value="1"/>
<enum name="DARKEN " value="2"/>
<enum name="DST" value="3"/>
<enum name="DST_ATOP" value="4"/>
<enum name="DST_IN" value="5"/>
<enum name="DST_OUT" value="6"/>
<enum name="DST_OVER" value="7"/>
<enum name="LIGHTEN" value="8"/>
<enum name="MULTIPLY" value="9"/>
<enum name="OVERLAY" value="10"/>
<enum name="SCREEN" value="11"/>
<enum name="SRC" value="12"/>
<enum name="SRC_ATOP" value="13"/>
<enum name="SRC_IN" value="14"/>
<enum name="SRC_OUT" value="15"/>
<enum name="SRC_OVER" value="16"/>
<enum name="XOR" value="17"/>
</attr><attr format="boolean" name="anti_aliasing"/></declare-styleable>
<declare-styleable name="NextBaseEditText"><attr format="boolean" name="upper_case"/><attr format="boolean" name="block_special_char"/><attr format="boolean" name="allow_email_char"/><attr format="boolean" name="block_numbers"/><attr name="android:text"/><attr format="boolean" name="error_enabled"/><attr name="android:hint"/><attr name="android:textSize"/><attr name="android:maxLines"/><attr format="string" name="fontType"/><attr name="android:maxLength"/><attr name="android:textColor"/><attr format="reference" name="textColorHint"/><attr format="reference" name="til_style"/><attr name="android:textAllCaps"/><attr format="boolean" name="optional"/></declare-styleable>
<declare-styleable name="NextCalendarView"><attr format="color" name="textColor"/><attr format="color" name="textSelectedColor"/><attr format="color" name="selectedColor"/></declare-styleable>
<declare-styleable name="NextCheckBox"><attr format="string" name="key"/><attr name="android:text"/><attr format="color" name="squareStrokeColor"/><attr name="android:textColor"/></declare-styleable>
<declare-styleable name="NextCheckablePageIndicator"><attr format="color" name="strokeLineColor"/><attr format="color" name="checkedStrokeLineColor"/><attr format="color" name="checkImageColor"/><attr format="color" name="dotColor"/></declare-styleable>
<declare-styleable name="NextDatePickerButton"><attr format="enum" name="calendar_tipe">
<enum name="android" value="0"/>
<enum name="next" value="1"/>
</attr><attr format="string" name="date_patern"/><attr format="enum" name="calendar_swipe_orientation">
<enum name="horizontal" value="0"/>
<enum name="vertical" value="1"/>
</attr><attr format="string" name="calendar_title"/></declare-styleable>
<declare-styleable name="NextFlowView"><attr format="dimension" name="flowStrokeWidth"/></declare-styleable>
<declare-styleable name="NextForm"><attr format="boolean" name="validateOnStart"/><attr format="boolean" name="editable"/><attr format="boolean" name="multilevelData"/><attr format="string" name="titleHeader"/><attr format="color" name="titleHeaderColor"/><attr name="android:paddingLeft"/><attr name="android:paddingRight"/><attr name="android:paddingBottom"/><attr name="android:paddingTop"/></declare-styleable>
<declare-styleable name="NextFormExpandableSubForm"><attr name="android:text"/><attr format="boolean" name="expanded"/><attr format="boolean" name="subFormBottomLineVisible"/></declare-styleable>
<declare-styleable name="NextFormItemContainer"><attr format="boolean" name="disableable"/><attr format="boolean" name="required"/><attr format="string" name="invalidMessage"/><attr format="string" name="emptyMessage"/><attr format="string" name="placeholder"/><attr format="string" name="fieldName"/><attr format="color" name="placeholderColor"/><attr format="float" name="placeholderAlpha"/><attr format="boolean" name="bottomLineVisible"/><attr format="color" name="bottomLineColor"/><attr name="android:enabled"/><attr name="autoSpace"/><attr name="hasImageInfo"/><attr name="imageInfoDrawable"/></declare-styleable>
<declare-styleable name="NextFormSubFormList"><attr format="reference" name="subFormLayout"/></declare-styleable>
<declare-styleable name="NextPicker"><attr format="color|reference" name="solidColor"/><attr format="reference" name="selectionBackground"/><attr format="reference" name="selectionDivider"/><attr format="dimension" name="selectionDividerHeight"/><attr format="dimension" name="selectionDividersDistance"/><attr format="dimension" name="internalMinHeight"/><attr format="dimension" name="internalMaxHeight"/><attr format="dimension" name="internalMinWidth"/><attr format="dimension" name="internalMaxWidth"/><attr format="reference" name="internalLayout"/><attr format="reference" name="virtualButtonPressedDrawable"/><attr format="reference" name="NextPickerStyle"/></declare-styleable>
<declare-styleable name="NextPickerButton"><attr format="string" name="blankText"/><attr name="android:textColor"/><attr format="reference" name="pickerDrawable"/><attr format="color" name="pickerDrawableColor"/></declare-styleable>
<declare-styleable name="NextRadioButton"><attr name="android:checked"/><attr format="string" name="value"/><attr name="android:text"/><attr name="android:textColor"/><attr format="color" name="circleStrokeColor"/><attr format="string" name="textTop"/><attr format="string" name="textBottom"/><attr name="android:orientation"/><attr format="boolean" name="multiCheck"/></declare-styleable>
<declare-styleable name="NextSmileView"><attr format="color" name="smileStrokeColor"/></declare-styleable>
<declare-styleable name="NextSquaredGraphView"><attr format="dimension" name="strokeWidth"/><attr format="dimension" name="cornerRadius"/><attr format="color" name="backStrokeColor"/></declare-styleable>
<declare-styleable name="NextSwitchButton"><attr format="string" name="keySwitcher"/><attr name="android:text"/><attr name="android:textColor"/><attr name="hasImageInfo"/><attr name="imageInfoDrawable"/><attr name="autoSpace"/></declare-styleable>
<declare-styleable name="NextTextView"><attr format="enum" name="NextFontType">
<enum name="newjune_medium" value="1"/>
<enum name="newjune_semibold" value="2"/>
<enum name="newjune_book" value="3"/>
</attr></declare-styleable>
<declare-styleable name="NextTitleSession"><attr name="android:text"/><attr name="android:textColor"/></declare-styleable>
<dimen name="default_padding">30dp</dimen>
<dimen name="horizontal_indicator_corner">8dp</dimen>
<dimen name="next_animated_icon_height">24dp</dimen>
<dimen name="next_animated_icon_width">24dp</dimen>
<dimen name="next_checkbox_icon_apply_size">24dp</dimen>
<dimen name="next_checkbox_square_border_size">48dp</dimen>
<dimen name="next_checkbox_square_container_size">48dp</dimen>
<dimen name="next_edittext_font_size">15sp</dimen>
<dimen name="next_expandable_title_text_size">10sp</dimen>
<dimen name="next_form_header_height">154dp</dimen>
<dimen name="next_form_header_padding_top">36dp</dimen>
<dimen name="next_form_header_text_title_size">15sp</dimen>
<dimen name="next_item_auto_margin_bottom">20dp</dimen>
<dimen name="next_item_container_error_message_font_size">10sp</dimen>
<dimen name="next_item_container_placeholder_font_size">10sp</dimen>
<dimen name="next_page_indicator_dot">5dp</dimen>
<dimen name="next_page_indicator_dot_margin">4dp</dimen>
<dimen name="next_picker_button_text_size">15sp</dimen>
<dimen name="next_radio_button_circle_container_size">70dp</dimen>
<dimen name="next_radio_button_circle_margin">10dp</dimen>
<dimen name="next_radio_button_green_circle_size">30dp</dimen>
<dimen name="next_radio_button_grey_circle_size">52dp</dimen>
<dimen name="next_radio_button_text_font_size">15sp</dimen>
<dimen name="next_radio_button_text_footer_font_size">10sp</dimen>
<dimen name="next_radio_button_text_header_font_size">10sp</dimen>
<dimen name="next_radio_button_text_margin">12dp</dimen>
<dimen name="next_radio_button_vertical_width">135dp</dimen>
<dimen name="next_switch_button_layout_height">54dp</dimen>
<dimen name="next_switch_button_text_margin">10dp</dimen>
<dimen name="next_switch_button_text_size">15sp</dimen>
<dimen name="next_switch_button_view_size">48dp</dimen>
<dimen name="next_title_session_text_size">10sp</dimen>
<dimen name="period_picker_corner">26dp</dimen>
<dimen name="period_picker_corner_horizontal_margin">0dp</dimen>
<dimen name="period_picker_horizontal_margin">0dp</dimen>
<dimen name="period_picker_vertical_margin">10dp</dimen>
<item name="np__decrement" type="id"/>
<item name="np__increment" type="id"/>
<string name="add">+ Adicionar</string>
<string name="agendar">AGENDAR</string>
<string name="app_name">NextComponents</string>
<string name="date_patern_expanded_br">dd/MM/yyyy</string>
<string name="date_patern_short_br">dd/MM/yy</string>
<string name="datepickerdialog_calendar">Calendário</string>
<string name="default_blank_message">deve ser preenchido</string>
<string name="default_invalid_message">Inválido</string>
<string name="friday_prefix">S</string>
<string name="monday_prefix">S</string>
<string name="optional">Opcional</string>
<string name="picker_default_text">Selecione</string>
<string name="receipts_period">%1$s até %2$s</string>
<string name="receipts_period_end_date_invalid">A data final deve ser menor que a data atual</string>
<string name="receipts_period_period_title">PERÍODO</string>
<string name="receipts_period_start_date_invalid">A data inicial deve ser menor que a data atual</string>
<string name="remove">- Remover</string>
<string name="saturday_prefix">S</string>
<string name="sunday_prefix">D</string>
<string name="tag_ico">ico</string>
<string name="text_date_end">Data final</string>
<string name="text_date_start">Data inicial</string>
<string name="text_title_calendar">Calendário</string>
<string name="thursday_prefix">Q</string>
<string name="title_header_example">New June Book 15 pt\nLorem Ipsum dolor sit\namet, consectetur.</string>
<string name="tuesday_prefix">T</string>
<string name="wednesday_prefix">Q</string>
<style name="AnimatedIconToolbar">
<item name="android:layout_width">@dimen/next_animated_icon_width</item>
<item name="android:layout_height">@dimen/next_animated_icon_height</item>
</style>
<style name="CustomPicker">
<item name="android:textAppearance">?android:attr/textAppearance</item>
<item name="android:orientation">vertical</item>
<item name="android:fadingEdge">none</item>
<item name="android:fadingEdgeLength">0dp</item>
</style>
<style name="DialogAnimations">
<item name="android:windowEnterAnimation">@anim/slide_up</item>
<item name="android:windowExitAnimation">@anim/slide_down</item>
</style>
<style name="GreenPicker" parent="CustomPicker">
<item name="solidColor">@android:color/transparent</item>
<item name="selectionBackground">@color/next_green_6</item>
<item name="internalLayout">@layout/next_number_picker_with_selector</item>
<item name="internalMinWidth">64dip</item>
<item name="internalMaxHeight">200dp</item>
<item name="internalMinHeight">200dp</item>
</style>
<style name="NextButton">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">55dp</item>
<item name="android:textAllCaps">false</item>
<item name="android:textSize">15sp</item>
<item name="NextFontType">newjune_book</item>
</style>
<style name="NextButtonBlack" parent="NextButton">
<item name="android:textColor">@drawable/next_background_text_button_black</item>
<item name="android:background">@drawable/next_background_button_black</item>
</style>
<style name="NextButtonGreen" parent="NextButton">
<item name="android:textColor">@drawable/next_background_text_button_green</item>
<item name="android:background">@drawable/next_background_button_green</item>
</style>
<style name="NextButtonWhite" parent="NextButton">
<item name="android:textColor">@drawable/next_background_text_button_white</item>
<item name="android:background">@drawable/next_background_button_white</item>
</style>
<style name="NextCalendarDayListDark">
<item name="android:textColor">@color/next_black_1</item>
<item name="android:textSize">12sp</item>
<item name="android:textStyle">bold</item>
</style>
<style name="NextCalendarDayOfWeekInitials" parent="NextCalendarStyle">
<item name="android:textSize">12sp</item>
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">1</item>
<item name="android:gravity">center</item>
</style>
<style name="NextCalendarItemDark">
<item name="android:textColor">@color/next_gray_2</item>
<item name="android:textSize">12sp</item>
</style>
<style name="NextCalendarStyle">
<item name="android:textColor">@color/next_black_1</item>
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
</style>
<style name="NextCalendarStyleBlack">
<item name="android:background">@color/next_green_4</item>
<item name="android:textColor">@color/next_black_1</item>
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
<item name="calendarTextHeaderStyle">@style/NextCalendarTextHeaderDark</item>
<item name="calendarItemStyle">@style/NextCalendarItemDark</item>
<item name="calendarDaysOfWeekListStyle">@style/NextCalendarDayListDark</item>
<item name="calendarSelectedDayColor">@color/next_white_1</item>
<item name="calendarUnselectedDayColor">@color/next_black_1</item>
<item name="dividerColor">@color/next_green_3</item>
<item name="circumference">@drawable/circumference_green</item>
</style>
<style name="NextCalendarTextHeaderDark">
<item name="android:textColor">@color/next_black_1</item>
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
</style>
<style name="NextCheckBox">
<item name="android:textColor">@color/next_black_1</item>
</style>
<style name="NextCheckBoxDark">
<item name="android:textColor">@color/next_gray_6</item>
<item name="squareStrokeColor">@color/next_gray_1</item>
</style>
<style name="NextCheckablePageIndicator">
<item name="strokeLineColor">@color/next_gray_2</item>
<item name="checkedStrokeLineColor">@color/next_green</item>
<item name="checkImageColor">@color/next_black_1</item>
<item name="dotColor">@color/next_gray_2</item>
</style>
<style name="NextEditText">
<item name="android:singleLine">true</item>
<item name="android:textSize">@dimen/next_edittext_font_size</item>
</style>
<style name="NextEditTextDark" parent="NextEditText">
<item name="android:textColor">@color/next_gray_6</item>
</style>
<style name="NextEditTextLight" parent="NextEditText">
<item name="android:textColor">@color/next_black_1</item>
</style>
<style name="NextErrorInputStyle" parent="NextNormalInputStyle">
<item name="android:textColor">@color/color_edittext_error</item>
</style>
<style name="NextForm">
<item name="android:background">@color/next_gray_6</item>
<item name="titleHeaderColor">@color/next_gray_3</item>
</style>
<style name="NextFormDark">
<item name="android:background">@color/next_black_1</item>
</style>
<style name="NextFormItemContainer">
<item name="placeholderColor">@color/next_black_1</item>
<item name="placeholderAlpha">0.3</item>
</style>
<style name="NextFormItemContainerDark">
<item name="placeholderColor">@color/next_white_1</item>
<item name="placeholderAlpha">0.5</item>
</style>
<style name="NextFormSeparatorLineLight">
<item name="android:alpha">0.6</item>
<item name="android:background">@color/next_black_1</item>
</style>
<style name="NextFormTextItemContainerLight" parent="NextFormItemContainer">
<item name="bottomLineVisible">true</item>
</style>
<style name="NextFullScreenDialog" parent="@android:style/Theme.Holo.Light">
<item name="android:windowBackground">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowEnterAnimation">@anim/slide_up</item>
<item name="android:windowExitAnimation">@anim/slide_down</item>
</style>
<style name="NextNormalInputStyle" parent="TextAppearance.AppCompat">
</style>
<style name="NextPickerButton">
<item name="android:textColor">@color/next_black_1</item>
<item name="pickerDrawableColor">@color/next_black_1</item>
</style>
<style name="NextPickerButtonDark">
<item name="android:textColor">@color/next_white_1</item>
<item name="pickerDrawableColor">@color/next_white_1</item>
</style>
<style name="NextRadioButton">
<item name="android:textColor">@color/next_black_1</item>
</style>
<style name="NextRadioButtonDark">
<item name="android:textColor">@color/next_gray_6</item>
<item name="circleStrokeColor">@color/next_gray_1</item>
</style>
<style name="NextSwitchButton">
<item name="android:textColor">@color/next_black_1</item>
</style>
<style name="NextTextLabel">
<!-- Hint color and label color in FALSE stateCd -->
<item name="android:textColorHint">#8d8d8d</item>
<!-- Label color in TRUE stateCd and bar color FALSE and TRUE State -->
<item name="colorAccent">#01ff54</item>
<item name="colorControlNormal">#313131</item>
<item name="colorControlActivated">#666666</item>
<item name="android:textSize">14sp</item>
<item name="NextFontType">newjune_semibold</item>
</style>
<style name="NextThemeDark" parent="android:Theme.Light">
<item name="android:textColor">@color/next_white_1</item>
<item name="android:background">@color/next_black_1</item>
<item name="calendarStyle">@style/NextCalendarStyleBlack</item>
<item name="tollBarCloseIcon">@drawable/ic_close_black</item>
<item name="tollBarCheckIcon">@drawable/ic_check_black</item>
</style>
<style name="NextTitleSession">
<item name="android:textColor">@color/next_gray_2</item>
</style>
<style name="TextLabelWhite">
<!-- Hint color and label color in FALSE stateCd -->
<item name="android:textColorHint">#FFFFFF</item>
<!-- Label color in TRUE stateCd and bar color FALSE and TRUE State -->
<item name="colorAccent">#01ff54</item>
<item name="colorControlNormal">#FFFFFF</item>
<item name="colorControlActivated">#FFFFFF</item>
<item name="android:textSize">14sp</item>
<item name="NextFontType">newjune_semibold</item>
</style>
</resources>
编辑:我的gradle文件
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.myappid"
minSdkVersion 19
targetSdkVersion 27
versionCode 2
versionName "1.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':nextcomponents')
compile 'com.android.support:appcompat-v7:27.0.1'
compile 'com.wdullaer:materialdatetimepicker:2.1.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion 19
targetSdkVersion 27
versionCode 2
versionName "1.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:27.0.1"
compile "com.google.code.gson:gson:2.8.0"
compile "com.android.support:design:27.0.1"
compile 'com.intellij:annotations:12.0@jar'
compile('org.apache.commons:commons-lang3:3.1') {
transitive = true
}
compile 'com.airbnb.android:lottie:1.5.3'
compile 'com.github.rubensousa:gravitysnaphelper:1.1'
compile 'com.facebook.keyframes:keyframes:1.0'
}
答案 0 :(得分:3)
您的DARKEN
枚举中有空格:
<enum name="DARKEN " value="2"/>
我通过egrep运行你的问题找到了这个:
egrep 'name="[^"]* [^"]*"'
这似乎是您正在使用的库中的一个问题:https://github.com/christophesmet/android_maskable_layout/blob/43b109a/library/src/main/res/values/attrs_maskable_framelayout.xml