美文网首页
weex环境配置的些许坑

weex环境配置的些许坑

作者: Fantast_d2be | 来源:发表于2020-04-13 18:07 被阅读0次

    weex 调试android开发环境

    运行

    weex run android
    
    • 问题1

    A problem occurred configuring project ':app'.
    groovy.lang.GroovyRuntimeException: Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated{apkData=Main{type=MAIN, fullName=debug, filters=[], versionCode=1, versionName=1.0.0}} of type com.android.build.gradle.internal.api.ApkVariantOutputImpl.

    • 解决方案
      进入platforms/android/app/build.gradle修改applicationVariants.all配置
    //        variant.outputs.all {
    //            outputFileName = "${variant.name}-${variant.versionName}.apk"
    //        }
            variant.outputs.each { output ->
                def outputFile = output.outputFile
                if (outputFile != null && outputFile.name.equals('app-debug.apk')) {
                    def fileName = outputFile.name.replace("app-debug.apk", "weex-app.apk")
                    output.outputFile = new File(outputFile.parent, fileName)
                }
            }
    
    • 问题2

    Execution failed for task ':app:javaPreCompileDebug'.
    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.
    - weexplugin-processor-1.3.jar (com.taobao.android:weexplugin-processor:1.3)
    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.

    • 解决方案
      进入platforms/android/app/build.gradle修改defaultConfig配置添加如下
    javaCompileOptions {
                annotationProcessorOptions {
                    includeCompileClasspath true
                }
            }
    

    完整的defaultConfig

    defaultConfig {
            applicationId "com.weex.app"
            minSdkVersion project.appMinSdkVersion
            targetSdkVersion project.targetSdkVersion
            versionCode 1
            versionName "1.0.0"
            ndk {
                abiFilters "x86"
                abiFilters "armeabi"
            }
            javaCompileOptions {
                annotationProcessorOptions {
                    includeCompileClasspath true
                }
            }
        }
    

    相关文章

      网友评论

          本文标题:weex环境配置的些许坑

          本文链接:https://www.haomeiwen.com/subject/vypnmhtx.html