2016-07-23 17 views
1

私はUdacityの課題に取り組んでおり、下の行をアプリのbuild.gradleファイルにコピーしなければなりませんでした:compile "com.android.support:appcompat-v7:22.1.0".アプリケーションを実行すると、シンボルRを解決できない、ビルドが失敗する、事前設定された値の問題などのエラーが発生しました。だから、私はAndroidスタジオをアンインストールしてみました.SDKをアップデートして、他のすべてが最新であることを確認しましたが、まだ解決策が見つかりませんでした。助けてください。 (ところで、私は初心者です)Build.gradleファイルを変更した後に例外が発生してビルドエラーが発生しました

ここでのGradleコンソールでのエラーです:

FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':app:processDebugResources'. 
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Hende\AppData\Local\Android\Sdk\build-tools\23.0.3\aapt.exe'' finished with non-zero exit value 1 

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

BUILD FAILED 

BUILD.GRADLE:

Apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.3" 

    defaultConfig { 
     applicationId "com.example.hende.justjava" 
     minSdkVersion 15 
     targetSdkVersion 23 
     versionCode 1 

    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.tools.build:gradle:2.1.2' 
} 

とMAINACTIVITY.JAVA:

は、
package com.example.hende.justjava; 


import android.os.Bundle; 
import android.support.v7.app.AppCompatActivity; 
import android.view.View; 
import android.widget.TextView; 

/** 
* This app displays an order form to order coffee. 
*/ 
public class MainActivity extends AppCompatActivity { 
    int quantity = 2; 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 
    } 

     /** 
     * This method is called when the plus button is clicked. 
     */ 
    public void increment(View view) { 
     quantity = quantity + 1; 
     displayQuantity(quantity); 



     /** 
     * This method is called when the minus button is clicked. 
     */ 
    }public void decrement(View view) { 
     quantity = quantity - 1; 
     displayQuantity(quantity); 

    } 

    /** 
    * This method is called when the order button is clicked. 
    */ 
    public void submit0rder(View view) { 
     int price = calculatePrice(); 
     String priceMessage = createOrderSummary(price); 
     displayMessage(createOrderSummary(price)); 
    } 
    /** 
    * Calculates the price of the order. 
    * @return total price 
    */ 
    private int calculatePrice() { 
     return quantity = quantity * 5; 

    } 
    /** 
    * Creates summary of order. 
    * @param price of order 
    * @return text summary 
    */ 
    private String createOrderSummary (int price){ 
     String priceMessage = "Name: Awesome + Alison "; 
     priceMessage+= "\nQuantity: " + quantity; 
     priceMessage+= "\nTotal: $" + price; 
     priceMessage+= "\nThank You!"; 
     return priceMessage; 
    } 

    /** 
    * This method displays the given quantity value on the screen. 
    */ 
    private void displayQuantity(int numberOfCoffees) { 
     TextView zeroTextView = (TextView) zeroTextView.findViewById(); 
     zeroTextView.setText("" + numberOfCoffees); 
    } 

    /** 
    * This method displays the given text on the screen. 
    */ 
    private void displayMessage(String message) { 
     TextView orderSummaryTextView = (TextView) findViewById(R.id.order_summary_text_view); 
     orderSummaryTextView.setText(message); 
    } 

} 
+0

あなたはAndroidスタジオにいますか? 2つの 'build.gradle'ファイルがありますか? – Bill

+0

@quidproquoはい、Androidスタジオを使用しています。 *** build.gradle ***あなたがその6番目のオプションをスクロールするとき、私はアプリケーションフォルダにあります。 – Nahidaa

答えて

0

お試しください

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

またはSDKのバージョン24を取得し、あなたがあなたのアプリケーションの依存関係に

compile 'com.android.tools.build:gradle:2.1.2' 

を含める必要はありません

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

を使用しています。

関連する問題