Skip to content

The path to the package is specified incorrectly. The Android Studio version is Koala | 2024.1.1. #27

@dapadz

Description

@dapadz

Greetings!

I ran into a few problems after updating the studio to Koala 2024.1.1

Incorrect creation of package

When creating my templates, I started getting incorrect package mapping. For some reason, the . character in the path is replaced with \

to add a package, I use the following code:

package {package}.{name}[-s]

This used to work perfectly before, and I got the correct packet path in the output:

package com.test.ui.screen.test

However, after the update, I get the wrong package path already:

package com\test\ui\screen.test

Creating Android Resource files is created outside of the res/... package

I created a template that should generate a page fragment layout file. This file is created together with the main fragment. I used your template as an example.

Previously, this template worked correctly. However, after the update, the files are res/... began to be created not in the resource package, but directly in the package with the page code.

For example, previously packages were created like this:

|--java
   |--ui
     |--screen
       |--test
         |--TestFragment.kt
|--res
   |--layout
     |--fragment_test.xml

After the update, I get:

|--java
   |--ui
     |--screen
     | |--test
     |   |--TestFragment.kt
     |--res
        |--layout
           |--fragment_test.xml

My json code for creating a template:

{
  "name": "fragment",
  "description": "Base fragment",
  "path": "/templates/fragment",
  "param": [
    "name"
  ],
  "selectParam": [],
  "addFile": [
    {
      "name": "{name}Fragment.kt",
      "path": "{name}[-s]",
      "fileTemplatePath": "FragmentTemplate.tm"
    },
    {
      "name": "{name}UiState.kt",
      "path": "{name}[-s]",
      "fileTemplatePath": "UiStateTemplate.tm"
    },
    {
      "name": "{name}Event.kt",
      "path": "{name}[-s]",
      "fileTemplatePath": "EventTemplate.tm"
    },
    {
      "name": "{name}ViewModel.kt",
      "path": "{name}[-s]",
      "fileTemplatePath": "ViewModelTemplate.tm"
    },
    {
      "name": "fragment_{name}[-s].xml",
      "path": "res/layout",
      "fileTemplatePath": "layout.tm"
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions