警告或错误1: warning: string 'delete_target_uninstall_label' has no default translationin
解决方案:[参考1](https://zhidao.baidu.com/question/1830062383679887660.html)
报错2: duplicate XXX...
解决方案:[参考2](http://blog.csdn.net/chenqiuping_ls/article/details/53409297)
报错3:Test工程报错,原因为误删app build.gradle部分文件依赖部分,[参考](http://blog.csdn.net/pkandroid/article/details/61535978)
可能还有其他问题,同样参考[参考2](http://blog.csdn.net/chenqiuping_ls/article/details/53409297)
`
apply plugin: ‘com.android.application’
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "io.github.cuncaojin.cloudplay"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
//use legacy for android 6.0
useLibrary 'org.apache.http.legacy'
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//Optional compile for GCM (Google Cloud Messaging).
compile 'com.android.support:support-v4:25.3.0'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:cardview-v7:25.3.0'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.android.gms:play-services-gcm:10.2.1'
compile 'com.squareup.okhttp:okhttp:2.0.0'
testCompile 'junit:junit:4.12'
// 环信
compile project(':easeui')
compile files('libs/android-support-multidex.jar')
compile files('libs/bolts-tasks-1.4.0.jar')
compile files('libs/umeng-analytics-v5.2.4.jar')
compile files('libs/parse-android-1.13.0.jar')
compile files('libs/umeng-update-v2.6.0.1.jar')
}
`
1、http://blog.csdn.net/chenqiuping_ls/article/details/53409297
2、https://zhidao.baidu.com/question/1830062383679887660.html
动态绑定
类对象的加载
public class StaticDemo {
private static StaticDemo instance = new StaticDemo();
static int n1;
static int n2 = 3;
private static StaticDemo instance2 = new StaticDemo();
int n3;
int n4 = 5;
public StaticDemo() {
System.out.println("------构造------");
System.out.println(++n1);
System.out.println(++n2);
System.out.println(++n3);
System.out.println(++n4);
}
public static StaticDemo getInstance(){
return instance;
}
public static void main(String[] args) {
StaticDemo instance = StaticDemo.getInstance();
System.out.println("--------main---------");
System.out.println(n1);
System.out.println(n2);
System.out.println(instance.n3);
System.out.println(instance.n4);
System.out.println(instance2.n3);
System.out.println(instance2.n4);
}
}
//////////////////////////////////////////////////
------构造------
1
1
1
6
------构造------
2
4
1
6
--------main---------
2
4
1
6
1
6
////////////////////////////////////////////////////
分析:
1、先对static按照文件中顺序,先默认初始化,再显示初始化。
2、显示初始化时,创建对象,则接下来继续执行如下:
1)对成员变量默认初始化
2)对成员显示初始化
3)执行构造方法
局部内部类访问局部变量,局部变量必须被final修饰
因为局部变量会随着方法的调用结束而消失,这个时候,局部对象还没有从堆内存中消失,还要使用那个局部变量。为了让数据还能继续使用,使用final修饰,这样在堆内存里存储的实际上是一个常量值。(可通过反编译查看)