尝试在android studio上运行我的项目时出错

时间:2017-12-07 16:48:49

标签: android android-studio

这是我的java代码:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    setContentView(R.layout.activity_main);

}

和这个xml文件:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.khanousse.lite.MainActivity"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="25dp">


<TextView
    android:id="@+id/textView"
    android:layout_width="298dp"
    android:layout_height="182dp"
    android:text="Hello World"
    android:textSize="30sp" />
   </android.support.constraint.ConstraintLayout>

我不知道为什么会收到此错误:

  

错误:任务&#39;:app:transformDexArchiveWithExternalLibsDexMergerForDebug&#39;执行失败。   &gt; java.lang.IllegalStateException:预期为BEGIN_ARRAY,但在第1行第1行为STRING

1 个答案:

答案 0 :(得分:0)

我早些时候遇到过这个问题,我只是通过

解决了这个问题
  1. 清理项目build>clean
  2. 重建项目build>rebuild
相关问题