相关文章推荐
急躁的绿茶  ·  opencv keras python - ...·  10 月前    · 
想出家的长颈鹿  ·  conda 查找spyder ...·  11 月前    · 
阳光的香槟  ·  Python中deque怎么用 ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

A week ago, I was successfully using ListView, adding an item to it every time a button is clicked. Then I found I needed to put something in a thread separate from the main UI thread , and somewhere along the way, something broke.

Now I'm seeing an error every time I start Android Studio, saying FileNotFoundException: Entry fileTemplates//code/Google Test Fixture SetUp Method.cc.ft not found in E:/Programs/Android Studio/lib/idea.jar I go to that very folder though, and I can see that the file exists. This is the closest I've come to figuring out how to fix it.

I've also tried a cold reboot of both my computer and my phone, reinstalling Android Studio, creating a brand new project, and File > Invalidate Caches and Restart, none of which were helpful.

The only other answers I can find say it's because of being a 64 bit version on a 32 bit system. I am certain that's not the case, unless I somehow downloaded 64 bit while specifically looking for 32 bit.

I have no idea whether it's a problem with Android Studio, Gradle, something to do with the phone I'm using as a testing platform, or what.

I'm using:

Windows 8.1 Pro (32-bit)

2x Pentium 3.2 GHz (x64)

Android Studio 2.3.3

minimum SDK of API 15: Android 4.0.3 IceCreamSandwich

Java v1.8.0_144 (according to "java -version" in a command prompt)

Java 8 updates 60 and 144 are in my list of installed programs, along with Java SE Development Kit 8 updates 60 and 144

Here's the code from the fresh project that I mentioned:

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>
                @GabeSechan - by just "writing" sure, but executed code can do anything, like delete or overwrite files. The code posted here doesn't come close to that though
– Krease
                Sep 25, 2017 at 19:38
                @Krease Sure, but it would be awfully difficult to break a host OS via an android app.  You'd pretty much have to be trying to do it
– Gabe Sechan
                Sep 25, 2017 at 19:40
                Android Studio breaks almost every time I upgrade it, which is at least once a week.  I have to spend several hours hunting down and correcting the issues the upgrades cause.  So yes, this particular IDE breaks all the time.
– SMBiggs
                Nov 21, 2017 at 8:07

It turns out, all I was doing wrong was trying to initialize listview before onCreate(). Declaring it is fine, but initializing breaks it. I guess, despite being defined in the xml, View objects aren't instantiated until runtime?

I have a backup I had made from before anything broke, but it was also broken. Or, now that I'm messing with it again, partially broken. (button doesn't work, but I can output to the listview) I suppose I took this to mean something within Android Studio might have been broken. I think that's why I didn't notice the difference in where I tried to initialize listview.

I guess any rock will break if you hit it long enough with a hammer, eh?

Ah, yes, thank you for the downvote with no reason, VERY helpful. Whoever you are, I hope you stub your toe. HARD. This is what fixed the question for me, and nobody else bothered to answer. – donutguy640 Oct 11, 2017 at 4:09 I apologize to those who commented on the question. You may not have "answered" but you were helpful, and I thank you. – donutguy640 Oct 11, 2017 at 15:43 Thanks for the answer. It may not be what some with similar questions want, but this happens. And thus your answer is definitely useful (+1). – SMBiggs Nov 21, 2017 at 8:08

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.