2016-04-14 3 views
1

私はアンドロイドスタジオプロジェクトを持っており、安定版2.0.0から実験版0.7.0-beta1に移植しています:gradle:2.0.0からgradle-experimental:0.7.0-beta1への移植エラー

これは私のandroidタグモジュールの作業用コードです。my 2.0 0.0のGradleコード:今ここに

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.3" 

    defaultConfig { 
     applicationId "com.test.myapp" 
     minSdkVersion 15 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 

     ndk { 
      moduleName "myNativeLib" 
     } 
    } 

    sourceSets.main { 
     jniLibs.srcDir 'src/main/libs' //set .so files location to libs 
     jni.srcDirs = [] //disable automatic ndk-build call 
    } 

    tasks.withType(JavaCompile) { 
     compileTask -> compileTask.dependsOn ndkBuild 
    } 

    task runSwig(type: Exec, description: 'Run swig config') { 
     workingDir 'src/main' 
     commandLine 'cmd', '/c', 'swig.bat' 
    } 

    Properties props = new Properties() 
    props.load(new FileInputStream(file(project.property("KeyStore.properties")))) 

    signingConfigs { 
     storeSignature { 
      storeFile = file(props['KEYSTORE']) 
      storePassword = props['KEYSTORE_PASSWD'] 
      keyAlias = props['KEYSTORE_MYAPP'] 
      keyPassword = props['KEYSTORE_MYAPP_PASSWD'] 
     } 
    } 

    buildTypes { 
     def SERVER_URL = "SERVER_URL" 
     debug { 
      debuggable true 
      jniDebuggable true 
      buildConfigField "String", SERVER_URL, "\"http://testusound.eastus.cloudapp.azure.com/androidbackend/checkjson\"" 
      versionNameSuffix getMasterName() + "." + getDate() 
     }   

     release { 
      signingConfig signingConfigs.storeSignature 
      debuggable false 
      jniDebuggable false 
      minifyEnabled false 
      buildConfigField "String", SERVER_URL, "\"http://www.usound.co/androidbackend/checkjson\"" 
      versionNameSuffix getMasterName() 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

は0.7.0-β1をpluggin expermientalための私のコードを書き換えるための私の試みです:

model { 
    android { 
     compileSdkVersion 23 
     buildToolsVersion "23.0.3" 

     defaultConfig.with { 
      applicationId "com.test.myapp" 
      minSdkVersion.apiLevel 15 
      targetSdkVersion.apiLevel 23 
      versionCode 1 
      versionName "1.0" 
     } 

     ndk { 
      moduleName "myNativeLib" 
     } 

     tasks.withType(JavaCompile) { 
      compileTask -> compileTask.dependsOn ndkBuild 
     } 

     task runSwig(type: Exec, description: 'Run swig config') { 
      workingDir 'src/main' 
      commandLine 'cmd', '/c', 'swig.bat' 
     } 

     buildConfigFields.with { 
      create() { 
       type "String" 
       name "SERVER_URL" 
       value "\"http://www.myserver.com/backend/checkjson\"" 
      } 
     } 

     buildConfigFields.with { 
      create() { 
       type "String" 
       name "TEST_SERVER_URL" 
       value "\"http://www.mytestserver.com/backend/checkjson\"" 
      } 
     } 

     sources { 
      main { 
       jni { 
        source { 
         srcDir "src" 
        } 
       } 
       jni.srcDirs = [] //disable automatic ndk-build call 
      } 
     } 

     buildTypes { 
      debug { 
       debuggable true 
       jniDebuggable true 
       buildConfigField $("android.buildConfigFields.TEST_SERVER_URL") 
       versionNameSuffix getMasterName() + "." + getDate() 
      } 
      release { 
       signingConfig = $("android.signingConfigs.mySignature") 
       debuggable false 
       jniDebuggable false 
       minifyEnabled false 
       buildConfigField $("android.buildConfigFields.SERVER_URL") 
       versionNameSuffix getMasterName() 
       proguardFiles.add(file('proguard-rules.pro')) 
      } 
     } 
     Properties props = new Properties() 
     props.load(new FileInputStream(file(project.property("KeyStore.properties")))) 
    } 

    android.signingConfigs { 
     create("mySignature") 
     storeFile = file(props['KEYSTORE']) 
     storePassword = props['KEYSTORE_PASSWD'] 
     keyAlias = props['KEYSTORE_MYAPP'] 
     keyPassword = props['KEYSTORE_MYAPP_PASSWD'] 
    } 
} 

私はsigningConfigsと、このエラーエラーを取得しています:

私のコードで
Error:Attempt to read a write only view of model of type 'java.lang.Object' given to rule 'android.signingConfigs { ... } @ app\build.gradle line 165, column 5' 

は、この行のようになります。

私は私のメインフォルダの下にkeystore.propertiesと呼ばれるファイルを使用しています、私の署名のconfigsのため
android.signingConfigs { 

(私はこのようにそれを維持したいと思います私はキーストアの署名データをgitにアップロードしないので、現在の実験的なgradleプロジェクトのような署名設定キーは置いていません)。

私はここで何が欠けていますか?ファイルから読み込まれたプロパティを使用するために署名設定を書き込むべきですか? 私はちょうど実験的なgradleに興味を持っているかもしれないと思ういくつかの例や情報を私に教えてもらっています。

答えて

0

ものは後に{}のセット

android.signingConfigs { 
    create("mySignature") { // <-- needed 
     storeFile = file(props['KEYSTORE']) 
     storePassword = props['KEYSTORE_PASSWD'] 
     keyAlias = props['KEYSTORE_MYAPP'] 
     keyPassword = props['KEYSTORE_MYAPP_PASSWD'] 
    } // <-- needed 
} 
であるべきであるが作成します
関連する問題