1.Android xxx is not translated in zh解决办法
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
}
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.
android {
...
defaultConfig {
...
//添加如下配置就OK了
javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
}
...
}
2, 将Eclipse项目导入到Android studio 中 很多点9图出现问题解决方法:
在build.gradle里添加以下两句:
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
3,ButterKnife的使用
(1)activity里使用
导包(as版本3.1以上)
defaultConfig {
。。。。。。
javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
}
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.jakewharton:butterknife-compiler:8.8.1'//fragment里使用必备的包
ButterKnife.bind(this);
(2)fragment里使用
private Unbinder unbinder;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.four_activity, container, false);
unbinder = ButterKnife.bind(this, view);
init();
return view;
}
/**
* onDestroyView中进行解绑操作
*/
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
}