什么是gradle.properties用于? (并使用外部variables)

我已经开发了一段时间的Android应用程序了,但是我意识到我还不知道gradle.properties文件是用来做什么的。 我已经通过Gradle文档了解了一些,例如,您可以添加用于指定Java Home或内存设置的配置。 还有什么可以用的吗? 我这个时代的主要参考通常是Google I / O开源应用程序,看着它的gradle.properties文件 ,我可以看到它的一个用处是存储依赖版本variables,所以Android的版本代码例如,支持库依赖关系不需要每个库的新版本都需要更新,只需要更新一个variables即可: … // Android support libraries. compile “com.android.support:appcompat-v7:${android_support_lib_version}” compile “com.android.support:cardview-v7:${android_support_lib_version}” compile “com.android.support:design:${android_support_lib_version}” compile “com.android.support:support-v13:${android_support_lib_version}” compile “com.android.support:recyclerview-v7:${android_support_lib_version}” compile “com.android.support:preference-v7:${android_support_lib_version}” … Google Play服务使用了相同的想法。 然而,在我自己的Android项目中,我一直在做类似的事情 – 我把我的版本variables放在root build.gradle文件中,如下所示: // Top-level build file where you can add configuration options // common to all sub-projects/modules. buildscript { ext.kotlin_version = ‘1.0.5-2’ repositories { […]

在Android Studio中Kotlin构建失败

错误: Error:Execution failed for task ‘:synclib:compileKotlin’. > com.intellij.openapi.fileTypes.LanguageFileType.(Lcom/intellij/lang/Language;)V synclib模块的build.gradle文件: apply plugin: ‘java’ apply plugin: ‘kotlin’ compileJava { sourceCompatibility = 1.7 targetCompatibility = 1.7 } dependencies { compile fileTree(dir: ‘libs’, include: [‘*.jar’]) testCompile ‘junit:junit:4.12’ // compile ‘com.android.support:appcompat-v7:23.1.1’ compile ‘com.firebase:firebase-client-jvm:2.2.3’ compile “org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version” compile project(‘:jamodel’) } buildscript { ext.kotlin_version = ‘1.0.0’ repositories { mavenCentral() } dependencies { classpath […]

使用LDAPvalidationSpring oauth / token请求上的客户端ID和客户端密钥

我正在调查客户端ID和客户端密码如何通过LDAP进行身份validation。 注意:这个Kotlin代码… @Configuration @EnableAuthorizationServer class OAuth2AuthorizationServerConfig() : AuthorizationServerConfigurerAdapter() { 我对Spring比较陌生,看来这不是我应该尝试的吗? 但是,这似乎是一个有用的选择。 为什么? 因为它允许我将客户端秘密管理委托给LDAP目录,并且有效地允许我的操作团队改变秘密(以某种管理的方式)。 有了这个我的应用程序不需要知道这个秘密。 这似乎很整齐? oauth的终点是基本认证 – 这似乎是Spring给我的@EnableAuthorizationServer注释。 请求http://somehost/oauth/token指定grant_type : client_credentials 。 我创建的代码来获取任意的令牌(沙箱)…我想只是指定适用于该客户端的客户端和范围,而不是指定秘密… @Throws(Exception::class) override fun configure( clients: ClientDetailsServiceConfigurer ) { // Inlining will create a store per credential entry val serviceBuilder = clients.inMemory() serviceBuilder.withClient(“user”).secret(“test”).scopes(“XXX”) } 我尝试了很多不同的想法,以便在LDAP Authentication Provider向管理的提供者集合中添加一个LDAP Authentication Provider ProviderManager ,从而失败了。 如果我在运行时调试到authenticate方法,我总是只有AnonymousAuthenticationProvider和DaoAuthenticationProvider 下面可能显示我的经验不足,但这里有一个例子,请阅读可能的疯狂 […]

Firestore本地过滤

Firestore每读取10万次读取配额和价格。 在基于关系的数据库中,我有非常简单的任务,但是对于Firestore而言,这看起来像是开销: 我有Firestore集合的“文章”,每篇文章都有字段“views_by_uids”作为Firebase用户UID的数组 我已经阅读了10万篇文章(简称) 我想为我的UID获取UNREaded文章 我是否真的需要用分页来查询这个100K的参考文章,例如每页50个项目,以便过滤LOCALLY(通过我的弱移动网络发送太多的数据),最后得到UNREaded文章来显示? 编辑:澄清这里是我如何用Kotlin在Android中创建“文章”: data class Article ( val title: String, val text: String, val ownerUid: String, @ServerTimestamp val creationDate: Date? = null) //写满文章到firestore val article = Article (title = “test title” text = “test text”, ownerUid = FirebaseAuth.getInstance().uid!!) val articleRef = FirebaseFirestore.getInstance() .collection(Article.COLLECTION_NAME) .document() .set(article) .addOnFailureListener { …just show error } […]

在C区块链平台

我试图了解可用的区块链框架,我有两个问题: 有没有任何允许区块链平台支持c / c + +,我看了Hyperledger和Corda,他们似乎是建立在和java? 另一个问题是,有没有真正的(我可以看到和研究源代码)开源的区块链平台(除了比特币),Hyperledger和Corda似乎只发布二进制文件

部署java web应用程序.war文件后未find404

我使用Spring框架在java中编写了一个Web应用程序。 测试并部署到远程Tomcat服务器。 部署后,我有消息OK – Started application at context path [/proxynator] 。 但是,如果我使用链接像http://109.206.178.66:8080/proxynator/和http://109.206.178.66:8080/proxynator/proxynator/test我有404 – Not Found和Description: The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. 在应用程序中,我有起动器类 @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } 和控制器 @RestController […]

如何在Android中使用animation将视图移动到另一个视图?

我在屏幕的中心有一个ImageView + TextView的圆圈。 我有另外两个ImageView + TextView ,一个在顶部,另一个在屏幕的底部。 我的要求是: 我想要一个顶级的ImageView + TextView的副本和一个底部的ImageView + TextView的副本在animation中移动到圆的中心,从而改变圆内的textView的值。 例如: 说顶部的textView值200和底部的textview值300.我想这些值的一部分(比如100或150)进行animation和移动到圆,但原始值200和300应保持在同一位置。 我试过使用TranslateAnimation 。 但是我面临的问题是find中心圆的x和y坐标。 它不完全走向圆圈的中心。 原始view’s位置也不保留。 TranslateAnimation animation = new TranslateAnimation(startLayout.getX(),endLayout.getX(), startLayout.getY(),endLayout.getY); animation.setDuration(1000); animation.setFillAfter(false); startView.startAnimation(animation); startLayout是ImageView和TextView所在的线性布局。 请帮忙! 谢谢!

在“LatLngBounds”构建器上设置最大缩放级别

我在搜索中没有find答案,所以有几个答案,但他们并没有为我工作。 我在地图上有两个标记,我正在使用LatLngBounds构建器,以便让相机缩放到正确的缩放级别以将它们包括在内。 一切都按预期工作,除了一个事情,当两个标记彼此非常接近时,地图非常放大而且很好,具有这个缩放级别没有任何意义。 LatLngBounds.Builder builder = new LatLngBounds.Builder(); builder.include(firstMarker.getPosition()); builder.include(secondMarker.getPosition()); LatLngBounds bounds = builder.build(); CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, markerPadding); 有没有办法强制一定程度的变焦,之后相机不会变焦? 这将避免让地图过于放大/缩小。 基本上我使用15.0f级别的缩放。 如果点太远,我想缩放以适应他们两个。 如果积分越来越近,我不希望缩放级别超过15.0f。

我们可以在xml中为android背景制作多个颜色渐变吗?

我一直在尝试在XML中创建多色背景,但只有3个选项可用,包括开始,中间,结束和指定的角度。 我们不能让这样的背景下面.. 我们可以在android中像这样的背景?

Android Kotlin创建类实现Parcelable在writeToParcel方法的“覆盖”中给出一个错误

为了使用Parcelable,我遵循了Kotlin 1.1.4的这个版本: https : //blog.jetbrains.com/kotlin/2017/08/kotlin-1-1-4-is-out/ 在项目中添加这一行 androidExtensions { experimental = true } 然后定义一个类: @Parcelize class User(val firstName: String, val lastName: String) : Parcelable writeToParcel()和createFromParcel()方法是自动创建的 override fun writeToParcel(parcel: Parcel, flags: Int) { … } 但是在消息的“覆盖”关键字中仍然存在错误 OVERRIDING_WRITE_TO_PARCEL_IS_NOT_ALLOWED:不允许覆盖“writeToParcel”。 改为使用“Parceler”随播对象 你能告诉我正确的方法吗? 编辑:只有默认构造函数中定义的属性将添加到包,其他不是? 我在这堂课看到这个警告。 PROPERTY_WONT_BE_SERIALIZED:属性不会被序列化为“包裹”。 添加“@Transient”注释以删除警告