0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AndroidStudio: プロジェクトのコピー

Last updated at Posted at 2023-11-27

Project01 というプロジェクトを、Project02 にコピーします。

前提条件
元のパッケージの名前に、プロジェクト名を含めないで下さい。
(含めるとコードの修正をする必要が発生します。
ですから、再利用の可能性がある時は、開発のスタート時に注意する必要があります。)

次は、Project01 の MainActivity.kt です。

MainActivity.kt
package org.ekzemplaro

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
    }
}

image.png

フォルダーのコピー

cp -r Project01 Project02

Project02 を開くと 左上が、Project01 と表示されます。
image.png

環境の修正

res/values.xml
<resources>
    <string name="app_name">Project02</string>
</resources>
settings.gradle.kts
(省略)
rootProject.name = "Project02"
(省略)

修正の反映

File -> Invalidate Caches
image.png

Invalidae and Restart をクリック

左上が、Project02 と表示されます。
image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?