我最近下载了Android Studio并尝试打开一个新项目。所生成看起来像这样的代码:无法在Android Studio中打开新程序
package com.example.trevo.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class GettingStarted extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_getting_started);
}
}
在我的屏幕顶部的选项卡(SCR,主,JAVA,COM,例如,trevo,所有MyApplication,GettingStarted)都以红色下划线。此外,行setContentView(R.layout.activity_getting_started);
中的'R'是红色,并且出现“无法解析符号”的错误。当我尝试按程序运行程序时,出现以下错误。
C:\Users\trevo\Documents\Java4Android_Projects\MyApplication\app\src\main\res\layout\activity_getting_started.xml
Error:(13, 49) String types not allowed (at 'layout_constraintBottom_toBottomOf' with value 'parent').
Error:(14, 45) String types not allowed (at 'layout_constraintLeft_toLeftOf' with value 'parent').
Error:(15, 47) String types not allowed (at 'layout_constraintRight_toRightOf' with value 'parent').
Error:(16, 43) String types not allowed (at 'layout_constraintTop_toTopOf' with value 'parent').
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
Information:BUILD FAILED
有没有其他人有Android Studio的这个问题?我能做些什么来弥补这些错误?
只需清理并通过工具栏上的生成选项重新生成。 –