我最近将Android Studio的Gradle插件版本从2.3.3更新到3.0.0,并按照显示的here
说明进行操作更新后的build.gradle(app)如下所示:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "demo.myProject.projectdemoversion"
minSdkVersion 15
targetSdkVersion 23
versionCode 41
versionName "2.26"
aaptOptions.setProperty("cruncherEnabled", false)
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
shrinkResources true
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':volley')
implementation('com.github.worker8:tourguide:1.0.17-SNAPSHOT@aar') {
transitive = true
}
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.android.support:cardview-v7:25.1.1'
implementation 'com.android.support:recyclerview-v7:25.1.1'
implementation 'ch.acra:acra:4.9.0'
implementation 'com.github.MKergall:osmbonuspack:6.2'
implementation 'com.android.support:appcompat-v7:25.0.1'
implementation 'com.google.android.gms:play-services-appindexing:8.4.0'
implementation 'com.google.android.gms:play-services-maps:8.4.0'
implementation 'com.google.android.gms:play-services-location:8.4.0'
implementation 'com.android.support:design:25.0.0'
implementation 'com.google.android.gms:play-services-analytics:8.4.0'
implementation 'org.osmdroid:osmdroid-android:5.6.4'
implementation 'org.slf4j:slf4j-android:1.7.12'
implementation 'com.android.support:support-v4:25.0.0'
implementation 'org.jetbrains:annotations-java5:15.0'
implementation 'com.facebook.android:account-kit-sdk:4.11.0'
implementation 'com.facebook.android:facebook-android-sdk:4.11.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'info.hoang8f:fbutton:1.0.5'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}
我的build.gradle(项目)如下:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
maven(){
url "https://oss.sonatype.org/content/repositories/snapshots"
}
google()
}
}
但不幸的是,它仍然显示与插件相关的错误。例如:
android.view.InflateException:二进制XML文件行#0:错误导致类info.hoang8f.widget.FButton
这是包含FButton元素的布局文件:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fbutton="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:background="@color/colorPrimary"
android:orientation="vertical"
tools:context="demo.myProject.projectdemoversion.activity.PhoneRegActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:src="@drawable/menu_image_360" />
<LinearLayout
android:id="@+id/firstreg"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center_horizontal|center_vertical"
android:orientation="vertical"
android:padding="@dimen/regpadding">
<TextView
android:id="@+id/phoneheader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="15dp"
android:text="Register here"
android:textColor="@color/white"
android:textSize="@dimen/regtext"
android:textStyle="bold" />
<com.rengwuxian.materialedittext.MaterialEditText
android:id="@+id/userid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/user"
android:drawablePadding="10dp"
android:hint="Write your name"
app:met_baseColor="@color/white"
app:met_floatingLabel="highlight"
app:met_textColorHint="@color/white" />
<com.rengwuxian.materialedittext.MaterialEditText
android:id="@+id/phone_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/phonereceiver"
android:drawablePadding="10dp"
android:hint="ফোন নাম্বার"
android:inputType="none"
android:padding="5dp"
app:met_baseColor="@color/white"
app:met_floatingLabel="normal"
app:met_textColorHint="@color/white" />
<info.hoang8f.widget.FButton
android:id="@+id/submittoserver"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/regsubbtnsize"
android:paddingBottom="@dimen/regsubbtn"
android:paddingLeft="@dimen/regsubbtn"
android:paddingRight="@dimen/regsubbtn"
android:paddingTop="@dimen/regsubbtn"
android:text="Submit"
android:textColor="@color/colorSecondaryText"
android:textSize="@dimen/offercounterbtn"
fbutton:buttonColor="@color/colorAccent"
fbutton:shadowColor="@color/colorPrimaryDark"
fbutton:shadowEnabled="true"
fbutton:shadowHeight="5dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/secondreg"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center_horizontal|center_vertical"
android:orientation="vertical"
android:padding="@dimen/regpadding"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|top"
android:padding="15dp"
android:text="Welcome"
android:textColor="@color/white"
android:textSize="@dimen/regtext"
android:textStyle="bold" />
<TextView
android:id="@+id/hellonaame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|top"
android:padding="15dp"
android:text="Register"
android:textColor="@color/white"
android:textSize="@dimen/regtext"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
任何帮助/建议将不胜感激。谢谢!