我在Android Studio 2.2 Preview 1中使用Android App和Backend模块在Google Messaging中创建了一个新项目.这是应用程序文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.xxx.xxx"
minSdkVersion 15
targetSdkVersion 23
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'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support:support-annotations:23.4.0'
compile project(path: ':backend', configuration: 'android-endpoints')
}
Run Code Online (Sandbox Code Playgroud)
但它给了:
错误:与依赖项'com.google.code.findbugs:jsr305'冲突.app(1.3.9)和测试app(2.0.1)的已解决版本有所不同.有关详细信息,请参阅http://g.co/androidstudio/app-test-app-conflict.
我是Android的新手,无法找到这个错误.我如何解决它?
gradle google-cloud-messaging android-studio build.gradle android-gradle-plugin
为什么我们不能在非静态内部类中使用静态方法?
如果我使内部类静态,它的工作原理.为什么?
我将Spring MVC调度程序映射为全局前端控制器servlet /*.
<servlet>
<servlet-name>home</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>home</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)
但是,此映射会停止访问CSS,JS,图像等静态文件,这些/res/文件都在文件夹中.
我怎么能访问它们?
如何防止对象被垃圾收集?
是否有最终确定或幻像参考或任何其他方法的方法?
我在接受采访时被问到这个问题.面试官建议finalize()可以使用.
我对这段代码有两个问题
public class Override {
private void f() {
System.out.println("private f()");
}
public static void main(String[] args) {
Override po = new Derived();
po.f();
}
}
class Derived extends Override {
public void f() {
System.out.println("public f()");
}
}
/*
* Output: private f()
*/// :~
Run Code Online (Sandbox Code Playgroud)
1)如何在Override po的引用上看到函数f;
2)为什么输出"private f()"
在servlet中,在finalize()之前或之后调用destroy()?