问题一:

Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated{apkData=Main{type=MAIN, fullName=commonDebug, filters=[]}} of type com.android.build.gradle.internal.api.ApkVariantOutputImpl. Open File

解决方案一:

https://stackoverflow.com/questions/44239235/android-gradle-3-0-0-alpha2-plugin-cannot-set-the-value-of-read-only-property

I used this code

 applicationVariants.all { variant ->                variant.outputs.each { output ->                    def outputFile = output.outputFile                    if (outputFile != null && outputFile.name.endsWith('.apk')) {                        //输出apk名称为:应用名.apk                        def fileName = "xxx.apk"                        output.outputFile = new File(outputFile.parent, fileName)                    }                }            }

**Use all() instead of each()
Use outputFileName instead of output.outputFile if you change only file name (that is your case)**

Example from the guide:

// If you use each() to iterate through the variant objects,// you need to start using all(). That's because each() iterates// through only the objects that already exist during configuration time—// but those object don't exist at configuration time with the new model.// However, all() adapts to the new model by picking up object as they are// added during execution.android.applicationVariants.all { variant ->                variant.outputs.all {                    outputFileName = "xxx.apk"                }            }

问题二:

Error:All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html

解决方案二:

http://blog.csdn.net/syif88/article/details/75009663

大致是说,Plugin 3.0.0之后有一种自动匹配消耗库的机制,便于debug variant 自动消耗一个库,然后就是必须要所有的flavor 都属于同一个维度。
为了避免flavor 不同产生误差的问题,应该在所有的库模块都使用同一个foo尺寸。

但是我们从中已经知道解决方案了:

在主 app 的 build.gradle 里面的

defaultConfig { targetSdkVersion:*** minSdkVersion :*** versionCode:*** versionName :***//版本名后面加句话,意思是flavor dimension 它的维度就是该版本号,//这样维度就是都是统一的了 **flavorDimensions "versionCode"**}

问题三:

Error:Execution failed for task ':youyoubao:javaPreCompileCommonDebug'.> Annotation processors must be explicitly declared now.  The following dependencies on the compile classpath are found to contain annotation processor.  Please add them to the annotationProcessor configuration.    - butterknife-compiler-8.6.0.jar (com.jakewharton:butterknife-compiler:8.6.0)  Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior.  Note that this option is deprecated and will be removed in the future.  See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.

解决方案三:

在 app 下的 build.gradle 的 defaultConfig 中加一句话:

defaultConfig {   ...   javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }}

更多相关文章

  1. Error: Failed to find 'ANDROID_HOME' environment variable.解
  2. Fragment与FragmentActivity间的数据通讯详细解决方案
  3. Android Sync 同步 源码问题解决方案
  4. android中出现javax.net.ssl.SSLPeerUnverifiedException的解决
  5. Android数据库升级解决方案
  6. Android无法访问本地服务器(localhost)的解决方案
  7. android SDK升级连接不上服务器解决方案(安装SDK)
  8. Android (Android Studio)adb启动失败 无法启动adb 解决方案
  9. android 程序退出解决方案

随机推荐

  1. Android: PLEASE DO NOT USE A WAKE LOCK
  2. Android(安卓)内存管理工具
  3. Android(安卓)如何设置网关和路由
  4. Android(安卓)5.0WebView选择本地文件
  5. Android(安卓)UI布局练习1(垂直分布)
  6. Android(安卓)Intents and Intent Filter
  7. [Android(安卓)Pro] APK
  8. Android的文件系统结构
  9. Android之ViewPager的使用
  10. android 蓝牙各种UUID