0

私のアプリでは、The Movies DB API を使用して最も人気のある映画のポスターを取得します。

以下の問題についてご協力をお願いいたします。

アプリを実行しようとするたびに、これらのエラーが発生します

エラー:(14, 77) エラー: 予期された

エラー:(14, 53) エラー: ';' 期待される

エラー:(14, 45) エラー: 浮動小数点リテラルの形式が正しくありません

apply plugin: 'com.android.application'


  android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.almaneakhaled.popularmoviesapp2"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }

    buildTypes.each {
        it.buildConfigField 'String', 'THE_MOVIE_DB', '967888xxxxxxxxx'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
 }

ここで、buildconfig.java でエラーが発生します。

ここの上部に、「ビルドフォルダーの下のファイルは生成され、編集しないでください」という行があります

 package com.almaneakhaled.popularmoviesapp2;

 public final class BuildConfig {
 public static final boolean DEBUG = Boolean.parseBoolean("true");
 public static final String APPLICATION_ID =      "com.almaneakhaled.popularmoviesapp2";
  public static final String BUILD_TYPE = "debug";
  public static final String FLAVOR = "";
 public static final int VERSION_CODE = 1;
  public static final String VERSION_NAME = "1.0";
  // Fields from build type: debug
  public static final String THE_MOVIE_DB = 967888xxxxxxxxx;// this line is causing the issue
}
4

1 に答える 1

2

バックスラッシュを使用する必要があります。

it.buildConfigField 'String', 'THE_MOVIE_DB', '967888xxxxxxxxx'

it.buildConfigField 'String', 'THE_MOVIE_DB', "\"967888xxxxxxxxx\""
于 2016-03-20T20:21:34.163 に答える