2016-03-02 36 views
0

這個問題的問題好像它已經回答了,但沒有更新,我的工作在Android工作室1.5.1.0,我在activity_main.xml中得到一個錯誤,並在MainActivity.java。在製作我的應用程序時,我沒有問題,直到我試圖運行它。採用Android 1.5.1影城

這是來到了,當我試圖運行它

Error:(13, 24) No resource found that matches the given name (at 'theme' with value '@style/AppTheme.AppBarOverlay'). 
    Error:(20, 29) No resource found that matches the given name (at 'popupTheme' with value '@style/AppTheme.PopupOverlay'). 
    Error:Execution failed for task ':app:processDebugResources. 

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Android\sdk\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1 

在我activity_main.xml中

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/AppTheme.AppBarOverlay"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" 
     app:popupTheme="@style/AppTheme.PopupOverlay" /> This is in red 

</android.support.design.widget.AppBarLayout> 

<include layout="@layout/content_main" /> 

<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fab" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom|end" 
    android:layout_margin="@dimen/fab_margin" 
    android:src="@android:drawable/ic_dialog_email" /> 

,並在我的mainactivity.java

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 
    final EditText tickets = (EditText)findViewById(R.id.txtTickets); 
    final Spinner group = (Spinner)findViewById(R.id.txtGroup); 
    Button cost = (Button)findViewById(R.id.btncost); 
    cost.setOnClickListener(new View.OnClickListener() { 
     final TextView result = ((TextView)findViewById(R.id.txtResult); 
     @Override 
     public void onClick(View v) { 
      numberOfTickets = Integer.parseInt(tickets.getText().toString()); 
      totalCost = costPerTickets * numberOfTickets; 
      DecimalFormat currency = new DecimalFormat("$###,###.##"); 
      groupchoice = group.getSelectedItem().toString(); 
      result.setText("Cost for " + groupchoice + " is " + currency.format(totalCost)); 
     } 
    }); 
} 

所有(R.)是紅

+0

'import com.example.your_package_name.R;'並改變你的主題。並上傳你的build.gradle文件 –

+0

我該怎麼做? –

+0

在這裏更新你的構建gradle文件 –

回答

0

清潔和重建項目

改變編譯工具的版本:

buildToolsVersion "23.0.2" 

獲取裏面的文件該設置app/build.gradle

+0

你的問題解決了嗎? @ Mrs_Are3 –

+0

早上好現在試試 –

+0

buildtools已被讀取23.0.2 –

0

每當我的R是紅色的,我發現,這是因爲被嚴重形成了我的資源XML文件之一,例如,它不會編譯創建R類。檢查資源文件的最近更改並查找問題(標記錯誤,錯誤引號等)。

+0

我做到了,唯一錯誤的是我的@ style/App.Theme.PopupOverlay連接到我的(R)。 –

0

你必須定義在值/風格第一「AppTheme.AppBarOverlay」和「AppTheme.PopupOverlay」

0

你查了一些關於如何更新您的build.gradle文件中其他的答案? herehere,對於我在Android Studio 2.2.2重新啓動並更新後工作。