草庐IT

conditional-compilation

全部标签

android ant -pre-compile 与 -pre-build

我正在开发一个android项目,我们在其中使用ant构建我们的版本。在更改代码中的versionName和其他一些标志时,我们使用Android-ant目标-pre-compile。您还可以使用-pre-buildandroid-ant目标。有人知道这两个目标之间的区别吗? 最佳答案 查看SDK的ant工具文件夹中的build.xml:默认情况下,-pre-compile和-pre-build都是空目标,因此什么都不做。唯一的区别是-pre-build将在-code-gen(非空)之前运行,而-pre-compile在它之后运行。

安卓工作室 Gradle : Error:Configuration with name 'compile' not found

我的项目刷新失败,并出现以下gradle脚本的错误:错误:找不到名为“compile”的配置。//顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项。buildscript{repositories{mavenCentral()}dependencies{classpath'com.android.tools.build:gradle:2.3.2'classpath'com.google.gms:google-services:3.1.0'//NOTE:Donotplaceyourapplicationdependencieshere;theybelong//intheind

android - 启用 androidX 导致 'Cannot change strategy of configuration ' :app:compile' after it has been resolved' error

我目前正在尝试将OpenId/Android-Apputh迁移到androidX并在执行所有更改后面临一个奇怪的问题gradle开始抛出以下错误:>Cannotchangestrategyofconfiguration':app:compile'afterithasbeenresolved.我添加之后android.enableJetifier=trueandroid.useAndroidX=true到'gradle.properties'提示我尝试记录所有可能的(使用println(cofigBlockName))配置block,发现在构建过程中未调用sourceSetsconfig

安卓数据绑定(bind) : conditional formatting to set layout_weight

如何使用android数据绑定(bind)在xml中设置layout_weight?在dimens文件夹中,我们提供dp/sp中的值。 最佳答案 这是一个适合我的绑定(bind)适配器,你的View确实需要在LinearLayout中,我认为如果你想设置权重的话:@BindingAdapter("android:layout_weight")funsetLayoutWeight(view:View,weight:Float){vallayoutParams=view.layoutParamsas?LinearLayout.Layou

安卓 NDK/JNI : "No rule to make target" error when compiling my hybrid iOS/Android project

在完成“makeclean”(执行makefile的内容)后,我正在尝试编译我的iOS/Android混合项目(使用build_native.sh)。我实际上是按照本教程中描述的步骤操作的:http://gameit.ro/2012/01/creating-an-iphone-and-android-cocos2d-x-hybrid-project-updated/#comment-635但是在尝试编译时出现以下错误:**Noruletomaketargetjni/../../libs/cocos2dx/platform/CCFileUtils.cpp',需要obj/local/arm

安卓工作室 : Testing: Library dependencies that have been compiled using java 8 or above

请帮忙。我在为androidstudio设置测试时遇到了非常糟糕的时间。我已经从cucumbergithub下载了计算器示例来练习cumcumber代码测试。https://github.com/cucumber/cucumber-jvm/tree/master/android(顺便说一句,其中一些品牌的名字非常奇怪)我尝试将它与AndroidStudio一起使用。该程序运行完美(耶!)。然而,测试没有。我有一个非常可怕的消息,每次运行它时都会困扰我。*Torundexinprocess,theGradledaemonneedsalargerheap.Itcurrentlyhasapp

Android studio:Could not find method compile() for arguments 问题解决及两种解决方法探讨延伸

Couldnotfindmethodcompile()forarguments问题全称Couldnotfindmethodcompile()forarguments[org.tensorflow:tensorflow-lite:+]onobjectoftypeorg.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.如图解决方法1(简单)将compile改为implementation即可,如图参考博客couldnotfindmethodcompile()forarguments解决方法2(进阶)将c

Java 模块没有 `api` ,必须使用 `compile` ?

如https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#new_configurations中所述,我们现在有api和implementation。在Android模块中,即applyplugin:'com.android.application',我们两者都有。然而,在普通的Java模块中,即applyplugin:'java'(由我的Android应用程序模块使用),我只能找到implementation,但找不到api.因此在其中一个依赖中,我需要使用compile,而不能使用a

android - `when condition` 检查的自定义 lint 规则

我正在使用Gson的序列化适配器RuntimeTypeAdapterFactory基于disciminator序列化数据。但是,当存在未知的鉴别器(来自API)并且未在客户端定义时,TypeAdapter将为空。在这种情况下,如果我有一个kotlinwhenconditioncheckas:when(fooType){isfooA->//blabaisfooB->//blaba//elseornullisnothandled}和fooType是null,它会崩溃,因为null条件没有被处理。有什么方法可以创建自定义lint规则(检测器)来检查条件(java中的instanceof)是否

android - 如何修复错误 Gradle DSL 方法未找到 : 'compile()' ?

我正在尝试将googleplay计费库与我的android应用程序集成,当我尝试添加此依赖项时(compile'com.android.billingclient:billing:1.0')在应用程序模块的build.gradle文件。我收到以下错误:ERROR:GradleDSLmethodnotfound:'compile()'Possiblecauses:Theproject'work'maybeusingaversionoftheAndroidGradleplug-inthatdoesnotcontainthemethod(e.g.'testCompile'wasaddedin