2017-07-25 14 views
0

ビルドタイプの基礎を勉強していて、アプリのリリースとデバッグのフレーバーを作成しようとしています。まず、自分のアプリのルートフォルダにディレクトリ設定を作成しました。次に、署名されたAPKキーを生成し、パスを設定ディレクトリとして設定しました。それからbuild.gradleで以下の変更を加えました。以下は私のbuild.gradleファイルです。Androidアプリケーションのリリースフレーバーをビルドするエラー

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 25 
buildToolsVersion "26.0.0" 
defaultConfig { 
    applicationId "com.example.sarthak.chitchatmessagingapp" 
    minSdkVersion 21 
    targetSdkVersion 25 
    versionCode 1 
    versionName "1.0" 
    testInstrumentationRunner 
    "android.support.test.runner.AndroidJUnitRunner" 
} 

signingConfigs { 
    chitchatReleaseConfig { 
     storeFile file("../config/releaseapkkey.jks"); 
     storePassword("123456"); 
     keyAlias("releaseapkkey"); 
     keyPassword("123456"); 
    } 
} 

buildTypes { 
    debug { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } release { 
     minifyEnabled true 
     zipAlignEnabled true 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     signingConfig signingConfigs.chitchatReleaseConfig 
    } releaseDebug { 
     debuggable true 
     minifyEnabled true 
     zipAlignEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     signingConfig signingConfigs.chitchatReleaseConfig 
    } 
} 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
    exclude group: 'com.android.support', module: 'support-annotations' 
}) 

compile 'com.android.support:appcompat-v7:25.3.1' 
compile 'com.android.support:design:25.3.1' 
compile 'com.google.firebase:firebase-auth:10.0.1' 
compile 'com.google.firebase:firebase-database:10.0.1' 
compile 'com.google.firebase:firebase-storage:10.0.1' 
compile 'com.firebaseui:firebase-ui-database:1.1.1' 
compile 'de.hdodenhof:circleimageview:2.1.0' 
compile 'com.squareup.picasso:picasso:2.5.2' 
compile 'com.squareup.okhttp:okhttp:2.4.0' 
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.+' 
compile 'id.zelory:compressor:2.0.0' 
compile 'com.android.support.constraint:constraint-layout:1.0.2' 
compile 'com.google.firebase:firebase-messaging:10.0.1' 
testCompile 'junit:junit:4.12' 
} 

apply plugin: 'com.google.gms.google-services' 

ただし、次のエラーが発生します。

Error:(25, 0) Could not find method release() for arguments [bu[email protected]7595456a] on BuildType_Decorated{name=debug, debuggable=true, testCoverageEnabled=false, jniDebuggable=false, pseudoLocalesEnabled=false, renderscriptDebuggable=false, renderscriptOptimLevel=3, minifyEnabled=false, zipAlignEnabled=true, signingConfig=SigningConfig_Decorated{name=debug, storeFile=C:\Users\Sarthak\.android\debug.keystore, storePassword=android, keyAlias=AndroidDebugKey, keyPassword=android, storeType=C:\Users\Sarthak\.android\debug.keystore, v1SigningEnabled=true, v2SigningEnabled=true}, embedMicroApp=false, mBuildConfigFields={}, mResValues={}, mProguardFiles=[C:\Users\Sarthak\Documents\AndroidProjects\ChitChat Messaging App\build\intermediates\proguard-files\proguard-android.txt-2.3.2, C:\Users\Sarthak\Documents\AndroidProjects\ChitChat Messaging App\app\proguard-rules.pro], mConsumerProguardFiles=[], mManifestPlaceholders={}} of type com.android.build.gradle.internal.dsl.BuildType. 

誰かがエラーの内容を把握するのに役立つことができますか?

答えて

1

各buildTypeの前に改行を追加します。

buildTypes { 
    debug { 
     ... 
    } 
    release { 
     ... 
    } 
    releaseDebug { 
     ... 
    } 
} 

あり、この} release {

のような以前のbuildTypeの閉じ括弧と同じ行に新しいbuildTypeを入れていないことを私がすることができましたあなたのスタイルを使って私のプロジェクトであなたの問題を引き起こします。私が提案したように改行を入れて修正することができました。これは、Gradleの解析方法とは関係があります。

+0

ありがとうございます!出来た。 Android Studioは時々奇妙です。 :P –

関連する問題