0

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>
donutguy640
  • 377
  • 1
  • 4
  • 20
  • 1
    Its pretty much impossible to actually break an IDE by writing code in it. – Gabe Sechan Sep 25 '17 at 19:04
  • That's what I'd thought, but what worked last week still doesn't work now. – donutguy640 Sep 25 '17 at 19:38
  • @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 '17 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 '17 at 19:40
  • I wasn't really suggesting that's what broke it anyway, just that that's what I was doing at the time. – donutguy640 Sep 25 '17 at 19:51
  • Can you change the path of "Google Test Fixture SetUp Method.cc" to Google_Test_Fixture_SetUp_Method Files resolver usually expects a '\ ' as escape for space. – Marcos Vasconcelos Sep 25 '17 at 19:55
  • @MarcosVasconcelos I'm guessing you mean edit idea.jar? If so, I imagine Android Studio can somehow, but I don't think I know how. – donutguy640 Sep 25 '17 at 19:59
  • Maybe, just a hint – Marcos Vasconcelos Sep 25 '17 at 20:03
  • @MarcosVasconcelos most of my attempts (using 7zip) just prevented Android Studio from even loading. I eventually downloaded WinRAR which at least allowed me to edit it as you said, but essentially did nothing. The error message still shows, but with underscores in place of spaces in the file name. – donutguy640 Sep 25 '17 at 21:03
  • Well, I began to think maybe I had the 64 bit version afterall, but it still appears not. I thought so since my downloaded file name matched that of the default download from their [main page][1]. Also, I have 2.3.3 (or 2.3.0 according to file properties?) and I thought they stopped supporting 32 bit after 2.2.3. I went and [downloaded][2] it a third time this morning, and get what looks to me like the same exact files. [1]https://developer.android.com/studio/index.html [2]https://developer.android.com/studio/index.html#downloads – donutguy640 Sep 26 '17 at 14:44
  • Actually, maybe that helped a little afterall...I still can't do what I was doing a week ago, but I no longer see the FileNotFoundException – donutguy640 Sep 26 '17 at 15:07
  • 1
    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 '17 at 08:07

1 Answers1

0

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?

donutguy640
  • 377
  • 1
  • 4
  • 20
  • 2
    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 '17 at 04: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 '17 at 15:43
  • 1
    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 '17 at 08:08