一週前,我成功地使用了ListView,每次點擊一個按鈕時都會添加一個項目。然後我發現我需要把東西放在一個線程separate from the main UI thread,並在某個地方的某個地方,一些東西壞了。我打破了Android Studio嗎?
現在,我每次啓動Android Studio時都會看到一個錯誤,並說FileNotFoundException: Entry fileTemplates//code/Google Test Fixture SetUp Method.cc.ft not found in E:/Programs/Android Studio/lib/idea.jar
儘管我轉到了該文件夾,但我可以看到該文件存在。 This是我最想弄清楚如何解決它。
我也嘗試了我的電腦和手機的冷啓動,重新安裝Android Studio,創建一個全新的項目,以及File> Invalidate Caches and Restart,這些都沒有幫助。
我能找到的唯一答案就是因爲它是32位系統上的64位版本。我確信情況並非如此,除非我特意下載64位而專門查找32位。
我不知道這是Android Studio的問題,Gradle,與我用作測試平臺的手機有什麼關係,或者是什麼。
我使用:
的Windows 8.1專業版(32位)
2X奔騰3.2 GHz的(64)
的Android 2.3.3工作室
API 15的最低SDK :Android 4.0.3 IceCreamSandwich
Java v1.8.0_144(根據命令提示符中的「java -version」)
名的Java 8更新60和144都在我安裝的程序列表中,使用Java SE開發工具包8個更新60和144
下面是我所提到的新項目中的代碼一起:
MainActivity的.java
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
ArrayList<String> listItems;
ArrayAdapter<String> adapter;
ListView listview = (ListView) findViewById(R.id.listview);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listItems = new ArrayList<>();
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, listItems);
listview.setAdapter(adapter);
}
public void sendAnother(View view) {
adapter.add("button clicked");
}
}
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="meh.myapplication.MainActivity">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="Testing"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<ListView
android:id="@+id/listview"
android:layout_width="0dp"
android:layout_height="431dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toTopOf="@+id/button"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
通過在其中編寫代碼實際上破壞IDE幾乎是不可能的。 –
這就是我的想法,但上週工作仍然不起作用。 – donutguy640
@GabeSechan - 通過「寫」確定,但執行的代碼可以做任何事情,如刪除或覆蓋文件。雖然 – Krease