這裏的錯誤:錯誤,無法解析方法,符號
C:\Users\User\AndroidStudioProjects\FinalProject\app\src\main\res\values-v21\styles.xml
Error:(3, 5) No resource found that matches the given name: attr 'windowActionBar'.
Error:(3, 5) No resource found that matches the given name: attr 'windowNoTitle'.
C:\Users\User\AndroidStudioProjects\FinalProject\app\src\main\res\values\styles.xml
Error:(11, 5) No resource found that matches the given name: attr 'windowActionBar'.
Error:(11, 5) No resource found that matches the given name: attr 'windowNoTitle'.
Error:(4, 5) No resource found that matches the given name: attr 'colorAccent'.
Error:(4, 5) No resource found that matches the given name: attr 'colorPrimary'.
Error:(4, 5) No resource found that matches the given name: attr 'colorPrimaryDark'.
C:\Users\User\AndroidStudioProjects\FinalProject\app\build\intermediates\res\merged\debug\values\values.xml
Error:(31) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
Error:(37) Error retrieving parent for item: No resource found that matches the given name 'ThemeOverlay.AppCompat.Dark.ActionBar'.
Error:(42) Error retrieving parent for item: No resource found that matches the given name 'ThemeOverlay.AppCompat.Light'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\User\AppData\Local\Android\sdk\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1
而且我的AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.user.finalproject">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<!--<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>-->
</activity>
<activity
android:name=".Login"
android:label="@string/title_activity_login"
android:theme="@style/AppTheme.NoActionBar">
<!--
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>-->
</activity>
<activity
android:name=".ReceiveOffer"
android:label="@string/title_activity_receive_offer"
android:theme="@style/AppTheme.NoActionBar">
<!--<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>-->
</activity>
<activity
android:name=".PostReviews"
android:label="@string/title_activity_post_reviews"
android:theme="@style/AppTheme.NoActionBar">
<!--<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>-->
</activity>
<activity
android:name=".PostComplaints"
android:label="@string/title_activity_post_complaints"
android:theme="@style/AppTheme.NoActionBar">
<!--<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>-->
</activity>
<activity
android:name=".RegistrationV"
android:label="@string/title_activity_registration_v"
android:theme="@style/AppTheme.NoActionBar">
<!--
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>-->
</activity>
<activity
android:name=".LoginV"
android:label="@string/title_activity_login_v"
android:theme="@style/AppTheme.NoActionBar">
<!-- <intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>-->
</activity>
<activity
android:name=".ProvideOffer"
android:label="@string/title_activity_provide_offer"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".RegActivity"
android:label="@string/title_activity_reg"
android:theme="@style/AppTheme.NoActionBar">
<!--<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>-->
</activity>
</application>
</manifest>
我mainactivity.java:
package com.example.user.finalproject;
import android.app.Activity;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup.LayoutParams;
public class MainActivity extends AppCompactActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
而且這種事情發生因爲不知道什麼原因。
請推薦一些解決方案,因爲我試過了: 1.安裝新的Android Studio 2.清理項目。 3. Gradle構建。
Styles.XML:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.NoActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
應用級別的build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "com.example.user.finalproject"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.example.user.finalproject"
minSdkVersion 19
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.0.3-alpha2'
compile 'com.android.support:design:23.0.3-alpha2'
compile 'com.android.support:support-annotations:23.0.3-alpha2'
compile 'com.android.support:support-v4:23.0.3-alpha2'
compile 'com.android.support:support-v13:23.0.3-alpha2'
compile 'com.android.support:gridlayout-v7:23.0.3-alpha2'
compile 'com.android.support:mediarouter-v7:23.0.3-alpha2'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.3'
}
}
在構建的gradle所示的錯誤是這樣的: 不能由C讀取軟件包名稱:\用戶\用戶\ AndroidStudioProjects \ FinalProject \程序\ SRC \主\ AndroidManifest.xml中
現在有這樣的錯誤:
com.android.ide.common.process.ProcessException :org.gradle.process.internal.ExecException:進程'command'C:\ Users \ User \ AppData \ Local \ Android \ sdk \ build-tools \ 23.0.3 \ aapt.exe''以非零退出值結束1
我沒有發生任何事@majid –
在你的問題的最後加上你的'styles.xml' – majid
你能提出一些建議嗎? - @ majid –