apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
// load properties
Properties properties = new Properties()
File localPropertiesFile = project.file("local.properties");
if(localPropertiesFile.exists()){
properties.load(localPropertiesFile.newDataInputStream())
}
File projectPropertiesFile = project.file("project.properties");
if(projectPropertiesFile.exists()){
properties.load(projectPropertiesFile.newDataInputStream())
}
//read properties
def projectName = properties.getProperty("project.name")
def projectGroupId = properties.getProperty("project.groupId")
def projectArtifactId = properties.getProperty("project.artifactId")
def projectVersionName = android.defaultConfig.versionName
def projectPackaging = properties.getProperty("project.packaging")
def projectSiteUrl = properties.getProperty("project.siteUrl")
def projectGitUrl = properties.getProperty("project.gitUrl")
def developerId = properties.getProperty("developer.id")
def developerName = properties.getProperty("developer.name")
def developerEmail = properties.getProperty("developer.email")
def bintrayUser = properties.getProperty("bintray.user")
def bintrayApikey = properties.getProperty("bintray.apikey")
def javadocName …Run Code Online (Sandbox Code Playgroud) 我们最近升级到 Android Gradle 插件 4.0.0-beta03。我们现在在构建我们的库模块之一时看到此错误
$ ./gradlew library_module:assemble 任务 ':library_module:bundleDebugAar' 执行失败。 > 构建 AAR 时不支持直接本地 .aar 文件依赖项。 生成的 AAR 将被破坏,因为来自任何本地 .aar 的类和 Android 资源 文件依赖项不会打包在生成的 AAR 中。以前的安卓版本 在这种情况下,Gradle 插件也会产生损坏的 AAR(尽管没有抛出此错误)。这 以下 :library_module 项目的直接本地 .aar 文件依赖项导致此错误: ______.aar
我可以看到这是几个月前添加到 AGP 中的。但他们没有提供更多关于原因的信息。
所以。
有没有办法使用Gradle运行特定的Android单元测试?我试过了
gradle -Dtest.single=UnitTestName connectedInstrumentTest
Run Code Online (Sandbox Code Playgroud)
但它似乎在包中运行所有测试.
提前谢谢,伊万.
我想use intent.setData(Uri uri)传递从URL获得的数据.为了做到这一点,我需要能够从URL创建一个Uri(或者从我从URL读取的byte [],或者ByteArrayInputStream我从中创建的byte[]等等).但是,我无法弄清楚应该怎么做.
那么,无论如何从URL获取的数据创建Uri而不首先将数据写入本地文件?
我已经阅读了使用单例模式的情况.一个常见的案例描述了单身人士单元测试中的困难,但我不清楚为什么会这样呢?如果单元测试是构建的一部分,你不能只引用单例并在需要时使用它吗?(我从java的角度思考,但我想这不重要)
我正在编写一个Android应用程序,它将连接到特定的WPA访问点,连接后,它将发出一个http调用.它不会保存网络配置.我已经阅读了连接到wifi网络上几乎所有关于堆栈溢出的帖子,但找不到对我有用的答案.这是我用来连接的代码..
WifiConfiguration wc = new WifiConfiguration();
wc.allowedAuthAlgorithms.clear();
wc.allowedGroupCiphers.clear();
wc.allowedPairwiseCiphers.clear();
wc.allowedProtocols.clear();
wc.allowedKeyManagement.clear();
wc.SSID = "\"".concat("<ssid>").concat("\"");
wc.preSharedKey = "\"".concat("<password>").concat("\"");
wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
wc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
wc.allowedProtocols.set(WifiConfiguration.Protocol.RSN); // For WPA2
wc.allowedProtocols.set(WifiConfiguration.Protocol.WPA); // For WPA
wc.priority = 0;
//wc.hiddenSSID = true;
wc.status = WifiConfiguration.Status.ENABLED;
// connect to and enable the connection
WifiManager wifiManager = (WifiManager) getSystemService(this.WIFI_SERVICE);
int netId = wifiManager.addNetwork(wc);
boolean wifiEnabled = wifiManager.enableNetwork(netId, true);
wifiManager.setWifiEnabled(true);
Log.d("opener", "addNetwork returned " + netId);
if (netId > 0) {
wifiId = netId;
}
Run Code Online (Sandbox Code Playgroud)
但是netId总是-1.我在两部不同的手机上试过它(ICS:HTC Rezound和GingerBread:摩托罗拉DroidX).两者显示完全相同的结果.我究竟做错了什么? …
我在AndroidStudio项目中添加了两个模块:
app-base
|
|----src
|____androidTest
|________MyTestBase.java
app
|
|----src
|____androidTest
|________MyTest.java
Run Code Online (Sandbox Code Playgroud)
一些常见的测试类在app-base的androidTest中定义,并在app'androidTest中使用.
我试图在app的build.gradle中添加以下代码:
evaluationDependsOn(':app-base')
compile project(':app-base')
androidTestCompile project(':app-base')
Run Code Online (Sandbox Code Playgroud)
我在settings.gradle中包含了app-base和app,gradlew项目的输出是:
Root project 'MyProject'
+--- Project ':app-base'
+--- Project ':app'
Run Code Online (Sandbox Code Playgroud)
通过这种方式没有编译错误,但是当我在ide中运行MyTest时,它表示找不到类MyTestBase.
你知道什么是错的吗?任何想法都表示赞赏.谢谢.
在Android 5.0中,单击列表项时,我的ListView会产生涟漪效应.有没有办法禁用这种效果?看看文档,我没有看到任何方式(https://developer.android.com/reference/android/widget/ListView.html)
我有一个包含多个 Gradle 模块的项目(我认为 Gradle 只是调用这些子项目)。基本上我在settings.gradle. 是否有 Gradle 命令来打印每个命令(名称或最好是提供的标签/描述)
Android工作室一直告诉我构建失败了.我没有使用Kotlin,我的所有代码都在JAVA中.只有当我想构建/运行项目时,我才会收到此错误.我总是需要删除.gradle文件夹并重新启动Android studio以使其再次运行.我觉得这不是一个IDE问题,因为我使用了IDE 3.1和3.3版本.我还将Kotlin更新到最新版本1.2.70
* What went wrong:
A problem occurred configuring project ':app'.
> Could not create task ':app:processProdDebugManifest'.
> java.lang.IllegalAccessException: Class kotlin.reflect.jvm.internal.FunctionCaller$FieldSetter can not access a member of class com.android.build.gradle.tasks.ManifestProcessorTask with modifiers "private"
ext.kotlin_version = "1.2.70"
Run Code Online (Sandbox Code Playgroud)
完成重新启动并使缓存无效后,构建成功,但在进行任何新的更改之后,我再次无法构建它,直到我重新启动整个IDE并删除.gradle文件夹
这是我的根项目版本号
ext {
// SDK and tools
minSDK = 18
targetSDK = 28
compileSDK = 28
buildTools = '28.0.2'
// SUPPORT LIBRARY
SupportLibrary = '28.0.0-rc02'
// Debug the App
debugMode = true
minify = true
proguard = false
multidex = false
// …Run Code Online (Sandbox Code Playgroud) android ×8
gradle ×3
unit-testing ×2
aar ×1
android-wifi ×1
bintray ×1
java ×1
kotlin ×1
singleton ×1
testing ×1
wifi ×1
wifimanager ×1