欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

【Windows】CreateProcess error=206,文件名或扩展名太长

程序员文章站 2022-03-03 08:23:23
...

 

目录

问题

解决

方式一

方式二

参考


 

问题

最近在Win 环境下跑APP,时不时的弹出 "CreateProcess error=206,文件名或扩展名太长" 的问题,刚开始的时候没咋注意,报错了,再次运行看着也不影响跑;

 

解决

方式一

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.ua.eshepelyuk:ManifestClasspath:1.0.0"
  }
}

apply plugin: "ua.eshepelyuk.ManifestClasspath"

注意: 此处应用在Projectbuild.gradle 文件中,而不是modulesbuild.gradle 文件;

 

此时Project/build.gradle 为如下所示:

import java.nio.file.Paths

apply from: 'dependencies.gradle'
apply plugin: "ua.eshepelyuk.ManifestClasspath"

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    ext.build_gradle_version = '3.3.2'
    ext.greendao_gradle_plugin_version = '3.2.2'
    ext.butterknife_gradle_plugin_version = '9.0.0'

    repositories {
//        maven { url "https://jitpack.io" }
        maven { url "https://maven.aliyun.com/repository/public" }
        maven { url "https://plugins.gradle.org/m2/" }
        mavenCentral()
        mavenLocal()
        google()
        jcenter()
    }

    dependencies {
        classpath "com.android.tools.build:gradle:$build_gradle_version"
        classpath "org.greenrobot:greendao-gradle-plugin:$greendao_gradle_plugin_version"
        classpath "com.jakewharton:butterknife-gradle-plugin:$butterknife_gradle_plugin_version"
        classpath "gradle.plugin.ua.eshepelyuk:ManifestClasspath:1.0.0"
//        classpath 'com.github.TWiStErRob.butterknife:butterknife-gradle-plugin:fix1431-SNAPSHOT'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven { url "https://maven.aliyun.com/repository/public" }
        maven { url "https://plugins.gradle.org/m2/" }
        mavenCentral()
        mavenLocal()
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
    File outFile = file(Paths.get(project.rootDir.toString(), 'outputs'))
    if (outFile.exists())
        outFile.deleteDir()
}

 

方式二

plugins {
  id "ua.eshepelyuk.ManifestClasspath" version "1.0.0"
}

 

参考

  1. ManifestClasspath;
  2. gradle-util-plugins;

 

 

(完)

 

 

 

相关标签: Windows