我试图使用新功能,直接将字体添加到xml但没有运气。
我为 26.0.0-beta2 支持库设置了我的项目,在font
文件夹中创建了res
资源文件夹,将一些字体复制到其中,并在尝试构建它时,我收到 错误:prolog中不允许内容。 消息。
这是结构:
我的应用' build.gradle
并不特别:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
ext {
supportLibVersion = '26.0.0-beta2'
constraintLayout = '1.0.2'
playServicesVersion = '10.2.6'
butterknifeVersion = '8.0.1'
stethoVersion = '1.5.0'
realmStethoVersion = '2.0.0'
daggerVersion = '2.11'
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我的模块build.gradle
是:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.test.myproject"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'jsr305'
})
compile "com.android.support:support-core-utils:$supportLibVersion"
compile "com.android.support:appcompat-v7:$supportLibVersion"
//ConstrainLayout
compile "com.android.support.constraint:constraint-layout:$constraintLayout"
//Dager2
compile "com.google.dagger:dagger-android:$daggerVersion"
compile "com.google.dagger:dagger-android-support:$daggerVersion"
annotationProcessor "com.google.dagger:dagger-android-processor:$daggerVersion"
testCompile 'junit:junit:4.12'
}
我在某个地方看到它只是暂时将字体移动到项目之外的某个地方,重建然后再移回它们,但这不起作用,我再次收到该消息。我在这里做错了什么?
谢谢!
答案 0 :(得分:6)
要使用这些新功能,您必须更新
classpath 'com.android.tools.build:gradle:
至3.0.0-alpha1至少