2017-09-16 80 views
1

我想构建我的第一个Ionic Cordova应用程序(天气应用程序)的发布版本,并获取错误“无法读取或创建安装属性文件”。如下面的控制台输出所示。IONIC CORDOVA - 无法读取或创建安装属性文件

显然这是一个权限问题,但我没有选中C:\ Program Files(x86)\ Android文件夹(和子目录)的只读,但仍然存在相同的问题。还有什么我失踪?几个小时以来一直困在这。

我正在Visual Studio中开发我的应用程序,未安装Android Studio。


C:\Dev\Zealand>ionic cordova build android --release 
[INFO] Running app-scripts build: --platform android --target cordova 

[14:58:54] build dev started ... [14:58:54] clean started ... 
[14:58:54] clean finished in 11 ms [14:58:54] copy started ... 
[14:58:54] transpile started ... [14:59:00] transpile finished in 
6.34 s [14:59:00] preprocess started ... [14:59:00] deeplinks started ... [14:59:00] deeplinks finished in 47 ms [14:59:00] 
preprocess finished in 57 ms [14:59:00] webpack started ... 
[14:59:00] copy finished in 6.86 s [14:59:15] webpack finished in 
15.31 s [14:59:15] sass started ... [14:59:18] sass finished in 2.44 s [14:59:18] postprocess started ... [14:59:18] removed unused font files [14:59:18] postprocess finished in 42 ms 
[14:59:18] lint started ... [14:59:18] build dev finished in 24.29 
s 
> ionic cordova prepare android 
> cordova prepare android [14:59:21] lint finished in 2.75 s 

> cordova build android × Running command - failed! 
     [ERROR] An error occurred while running cordova build android (exit code 1): 

    ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk 
    JAVA_HOME=C:\Program Files\java\jdk1.8.0_131 
    Subproject Path: CordovaLib 
    The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please 
    use Task.doLast(Action) instead. 
      at build_5uypyiboi6cuvi75t8w2rqt55.run(C:\Dev\Zealand\platforms\android\build.gradle:137) 
    Checking the license for package Android SDK Platform 25 in C:\Program Files 
    (x86)\Android\android-sdk\licenses 
    License for package Android SDK Platform 25 accepted. 
    Preparing "Install Android SDK Platform 25". 
    Warning: Failed to read or create install properties file. 

    BUILD FAILED 

    Total time: 6.774 secs 

    FAILURE: Build failed with an exception. 

    * What went wrong: 
    A problem occurred configuring root project 'android'. 
    > Failed to install the following SDK components: 
     [Android SDK Platform 25] 
     The SDK directory (C:\Program Files (x86)\Android\android-sdk) is not writeable, 
     please update the directory permissions. 

    * Try: 
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log 
    output. 
    Error: cmd: Command failed with exit code 1 Error output: 
    FAILURE: Build failed with an exception. 

    * What went wrong: 
    A problem occurred configuring root project 'android'. 
    > Failed to install the following SDK components: 
     [Android SDK Platform 25] 
     The SDK directory (C:\Program Files (x86)\Android\android-sdk) is not writeable, 
     please update the directory permissions. 

    * Try: 
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log 
    output. 

回答

0

Android SDK中居住在Program Files文件夹,因此写入文件的问题。将Android sdk移至C:\并更新环境ANDROID_HOME变量并解决问题。