Skip to content

Crash when opening project: Cannot get project directory. Path has not been set. #390

Description

@Michelle-Mission

Bug Report

Description

AndroidCodeStudio crashes when opening the editor/project.

The crash occurs because "ChatFragment" tries to access the project directory before the project path has been initialized.

Crash Log

java.lang.IllegalStateException:
Cannot get project directory. Path has not been set.

at com.tom.rv2ide.projects.internal.ProjectManagerImpl.getProjectDir(ProjectManagerImpl.kt:82)
at com.tom.rv2ide.utils.ProjectHelper.getProjectRoot(ProjectHelper.kt:531)
at com.tom.rv2ide.fragments.ChatFragment.(ChatFragment.kt:73)

The important part of the stacktrace is:

ChatFragment.(ChatFragment.kt:73)
→ ProjectHelper.getProjectRoot()
→ ProjectManagerImpl.getProjectDir()
→ Cannot get project directory. Path has not been set.

Environment

  • AndroidCodeStudio: "v1.0.0+gh.r04 (1025)"
  • Variant: "arm64-v8a"
  • Build type: "OFFICIAL"
  • Android SDK: "35"
  • Device: "OPPO CPH2591"
  • Architecture: "arm64-v8a"

Steps to Reproduce

  1. Open AndroidCodeStudio.
  2. Open a project/editor.
  3. Wait for the editor and fragments to initialize.
  4. The application crashes.

Expected Behavior

AndroidCodeStudio should initialize the project directory before "ChatFragment" tries to access it, or gracefully handle the project path being unavailable.

Actual Behavior

The application crashes with:

IllegalStateException:
Cannot get project directory. Path has not been set.

Suspected Cause

"ChatFragment" appears to call "ProjectHelper.getProjectRoot()" during Fragment construction/property initialization, before the project directory has been initialized.

The relevant location appears to be:

ChatFragment.kt:73

Full Stacktrace

java.lang.IllegalStateException: Cannot get project directory. Path has not been set.
at com.tom.rv2ide.projects.internal.ProjectManagerImpl.getProjectDir(ProjectManagerImpl.kt:82)
at com.tom.rv2ide.utils.ProjectHelper.getProjectRoot(ProjectHelper.kt:531)
at com.tom.rv2ide.fragments.ChatFragment.(ChatFragment.kt:73)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at androidx.fragment.app.Fragment.instantiate(Fragment.java:672)
at androidx.fragment.app.FragmentContainer.instantiate(FragmentContainer.java:57)
at androidx.fragment.app.FragmentManager$3.instantiate(FragmentManager.java:525)
at androidx.fragment.app.FragmentStateManager.restoreSaveStateInternal(FragmentManager.java:2562)

The remaining stacktrace is available in the original crash report.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions