(1)手动创建
在项目的顶部有个下拉,默认选择的是Android,
但是在Android 模式下不能真实反映整个工程的目录结构,所以我们点击它在下拉选项中选择Project,选完之后目录发生了变化
我们找到/src/main,选中main文件夹右键新建一个文件夹,命名为assets,这样就OK了。
(2)自动创建
Android studio提供了一个快捷的创建方式
Error:Execution failed for task ':app:javaPreCompileDebug'.
> Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration.
- butterknife-6.0.0.jar (com.jakewharton:butterknife:6.0.0)
Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior. Note that this option is deprecated and will be removed in the future.
See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.
打开app->build.gradle中android {
...
defaultConfig {
...
( 在defaultConfig中添加如下代码 :)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "ydyt.lantu.com.videoplayer"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath = true
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.jakewharton:butterknife:5.1.1'
}