国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Android Studio心得-創(chuàng)建登錄注冊項(xiàng)目

這篇具有很好參考價(jià)值的文章主要介紹了Android Studio心得-創(chuàng)建登錄注冊項(xiàng)目。希望對大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

? ? ? ? 首先先了解AndroidStudio是什么:Android Studio是一個(gè)由谷歌開發(fā)的Android應(yīng)用程序開發(fā)環(huán)境,用于開發(fā)Android應(yīng)用程序。它基于JetBrains IntelliJIDEA軟件,并包含了許多定制化功能,包括易于使用的分析工具、內(nèi)存分析工具和代碼編輯器等,支持Java、Kotlin等多種編程語言。Android Studio還提供了模擬器和虛擬設(shè)備來測試應(yīng)用程序,可以幫助開發(fā)者更加高效地進(jìn)行Android應(yīng)用程序開發(fā)。
? ? ? ?作為一款A(yù)ndroid應(yīng)用程序開發(fā)環(huán)境,AndroidStudio具有以下優(yōu)點(diǎn):

  1. 界面友好:Android Studio提供了簡單直觀的界面,并且其操作流暢,易于使用和學(xué)習(xí)。
  2. 功能強(qiáng)大:Android Studio集成了許多強(qiáng)大的功能,如代碼自動(dòng)完成、代碼檢查和重構(gòu)等,方便開發(fā)者快速創(chuàng)建高質(zhì)量的Android應(yīng)用程序。
  3. 支持多種編程語言:Android Studio支持多種編程語言,包括Java、Kotlin等,開發(fā)者可以根據(jù)自己的需求選擇使用不同的編程語言進(jìn)行開發(fā)。
  4. 良好的集成環(huán)境:Android Studio能夠與其他工具集成,例如Git等版本控制系統(tǒng),方便開發(fā)者在項(xiàng)目開發(fā)過程中協(xié)作。
  5. 豐富的插件: Android Studio提供了許多插件來擴(kuò)展其功能,比如可以安裝插件來調(diào)試代碼、設(shè)計(jì)圖形用戶界面等。

?接下來我?guī)Т蠹矣肁ndroid Studio創(chuàng)建一個(gè)登陸注冊項(xiàng)目:

1.創(chuàng)建—個(gè)新的Android項(xiàng)目,名稱為"LoginRegisterDemo"。不需要代碼。
2.在布局文件中設(shè)計(jì)好登錄和注冊頁面的UI界面,可以使用EditText來輸入用戶名和密碼。
首先在login_activity.xml中添加登錄頁面的U元素:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <EditText
        android:id="@+id/editText_userName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="請?zhí)顚懹脩裘?
        android:layout_marginTop="50dp"
        />

    <EditText
        android:id="@+id/editText_password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textPassword"
        android:hint="請?zhí)顚懨艽a"
        android:layout_below="@id/editText_userName"
        />

    <Button
        android:id="@+id/button_login"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="登錄"
        android:layout_below="@id/editText_password"
        android:layout_centerHorizontal="true"
        />

</RelativeLayout>

然后在register_activity.xml中添加注冊頁面的UI元素:
?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <EditText
        android:id="@+id/editText_userName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="請?zhí)顚懹脩裘?
        android:layout_marginTop="50dp"
        />

    <EditText
        android:id="@+id/editText_password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textPassword"
        android:hint="請?zhí)顚懨艽a"
        android:layout_below="@id/editText_userName"
        />

    <Button
        android:id="@+id/button_register"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="注冊"
        android:layout_below="@id/editText_password"
        android:layout_centerHorizontal="true"
        />

</RelativeLayout>

3.在Java代碼中創(chuàng)建—個(gè)數(shù)據(jù)庫類,用于保存用戶信息,并添加相應(yīng)的表,如用戶表。
首先,在app目錄下的build.gradle文件中添加Room庫的依賴:
?

dependencies {
    def room_version = "2.3.0"

    implementation "androidx.room:room-runtime:$room_version"
    annotationProcessor "androidx.room:room-compiler:$room_version"
}

然后定義一個(gè)User實(shí)體類,用于描述用戶信息:
?

@Entity(tableName = "users")
public class User {
    @PrimaryKey(autoGenerate = true)
    public int id;

    public String username;

    public String password;
}

接著定義一個(gè)UserDao類,用于與數(shù)據(jù)庫進(jìn)行交互:
?

@Dao
public interface UserDao {
    @Query("SELECT * FROM users WHERE username = :username AND password = :password")
    User findUser(String username, String password);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(User user);
}

最后定義一個(gè)AppDatabase類,作為數(shù)據(jù)庫的實(shí)體類:
?

@Database(entities = {User.class}, version = 1, exportSchema = false)
public abstract class AppDatabase extends RoomDatabase {
    private static AppDatabase sInstance;

    public static synchronized AppDatabase getInstance(Context context) {
        if (sInstance == null) {
            sInstance = Room.databaseBuilder(context.getApplicationContext(),
                    AppDatabase.class, "loginregisterdemo.db")
                    .build();
        }
        return sInstance;
    }

    public abstract UserDao userDao();
}

4.創(chuàng)建—個(gè)登錄Activity和一個(gè)注冊Activity,并在其中分別添加對應(yīng)的UI元素與邏輯實(shí)現(xiàn)。
首先創(chuàng)建—個(gè)LoginActivity類,在其中添加UI元素以及登錄邏輯:
?

public class LoginActivity extends AppCompatActivity {

    private EditText mEditTextUsername;
    private EditText mEditTextPassword;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        mEditTextUsername = findViewById(R.id.editText_userName);
        mEditTextPassword = findViewById(R.id.editText_password);

        Button buttonLogin = findViewById(R.id.button_login);
        buttonLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String username = mEditTextUsername.getText().toString();
                String password = mEditTextPassword.getText().toString();

                User user = AppDatabase.getInstance(LoginActivity.this).userDao().findUser(username, password);
                if (user == null) {
                    Toast.makeText(LoginActivity.this, "用戶名或密碼錯(cuò)誤", Toast.LENGTH_SHORT).show();
                } else {
                    Toast.makeText(LoginActivity.this, "登錄成功", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}

然后創(chuàng)建一個(gè)RegisterActivity類,在其中添加UI元素以及注冊邏輯:
?

public class RegisterActivity extends AppCompatActivity {

    private EditText mEditTextUsername;
    private EditText mEditTextPassword;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);

        mEditTextUsername = findViewById(R.id.editText_userName);
        mEditTextPassword = findViewById(R.id.editText_password);

        Button buttonRegister = findViewById(R.id.button_register);
        buttonRegister.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String username = mEditTextUsername.getText().toString();
                String password = mEditTextPassword.getText().toString();

                User user = new User();
                user.username = username;
                user.password = password;
                AppDatabase.getInstance(RegisterActivity.this).userDao().insert(user);

                Toast.makeText(RegisterActivity.this, "注冊成功", Toast.LENGTH_SHORT).show();
                finish();
            }
        });
    }
}

5.在登錄Activity的代碼中,通過輸入框獲取用戶輸入的用戶名和密碼,并根據(jù)這些信息從數(shù)據(jù)庫中查詢用戶信息來進(jìn)行登錄驗(yàn)證。
之前在LoginActivity類中已經(jīng)實(shí)現(xiàn)了登錄邏輯。如果用戶輸入的用戶名和密碼與數(shù)據(jù)庫中的用戶信息匹配,則登錄成功;否則提示用戶名或密碼錯(cuò)誤。
6.在注冊Activity的代碼中,通過輸入框獲取用戶的注冊信息,并將其保存到數(shù)據(jù)庫中。
之前在RegisterActivity類中已經(jīng)實(shí)現(xiàn)了注冊邏輯。當(dāng)用戶填寫完注冊信息后點(diǎn)擊注冊按鈕時(shí),該信息會(huì)被保存到數(shù)據(jù)庫中。
7.在登錄Activity和注冊Activity中添加相應(yīng)的按鈕監(jiān)聽事件,并在點(diǎn)擊按鈕時(shí)觸發(fā)對應(yīng)的事件邏輯。
? ? ? ? 之前已經(jīng)在LoginActivity和RegisterActivity類中分別添加了按鈕監(jiān)聽事件,當(dāng)用戶點(diǎn)擊登錄或注冊按鈕時(shí),對應(yīng)的邏輯代碼會(huì)被執(zhí)行。以上就是實(shí)現(xiàn)Android Studio中登錄注冊功能的完整步驟和代碼。需要注意的是,在實(shí)際開發(fā)過程中,還需要考慮一些細(xì)節(jié)問題,比如加密存儲(chǔ)密碼、輸入框輸入格式檢查等。

接下來是存儲(chǔ)用戶密碼跟加密儲(chǔ)存密碼的寫法又想要的可創(chuàng)建。選寫

存儲(chǔ)用戶密碼

?1.在用戶輸入密碼時(shí),通過如下代碼獲取密碼的哈希值:

public static String hashPassword(String password) {
    try {
        MessageDigest digest = MessageDigest.getInstance("SHA-256");
        byte[] hash = digest.digest(password.getBytes(StandardCharsets.UTF_8));
        return Base64.encodeToString(hash, Base64.DEFAULT);
    } catch (NoSuchAlgorithmException e) {
        e.printStackTrace();
        return null;
    }
}

⒉.將此哈希值與用戶名一起存儲(chǔ)到數(shù)據(jù)庫中。
3.在登錄時(shí),通過如下代碼檢查用戶名和密碼是否匹配:
?

public static boolean checkPassword(String providedPassword, String storedPasswordHash) {
    String hash = hashPassword(providedPassword);
    return hash != null && hash.equals(storedPasswordHash);
}

? ? ? ?建議每次登錄時(shí)都重新生成一個(gè)哈希值進(jìn)行比對,以增加安全性。使用哈希值存儲(chǔ)密碼可以避免明文存儲(chǔ)密碼,即使數(shù)據(jù)庫泄露也不會(huì)直接導(dǎo)致用戶密碼被泄露。
加密儲(chǔ)存密碼

下面是使用SHA-256算法對密碼進(jìn)行哈希加密和存儲(chǔ)到數(shù)據(jù)庫中的完整代碼:
1.定義一個(gè)加密工具類:

public class EncryptionUtils {

    public static String hashPassword(String password) {
        try {
            MessageDigest digest = MessageDigest.getInstance("SHA-256");
            byte[] hash = digest.digest(password.getBytes(StandardCharsets.UTF_8));
            return Base64.encodeToString(hash, Base64.DEFAULT);
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            return null;
        }
    }

    public static boolean checkPassword(String providedPassword, String storedPasswordHash) {
        String hash = hashPassword(providedPassword);
        return hash != null && hash.equals(storedPasswordHash);
    }
}

?2.在注冊時(shí),通過如下代碼獲取用戶輸入的密碼并加密,將加密后的密碼保存到數(shù)據(jù)庫中:

String username = mEditTextUsername.getText().toString();
String password = mEditTextPassword.getText().toString();
String encryptedPassword = EncryptionUtils.hashPassword(password); // 哈希加密密碼
User user = new User();
user.username = username;
user.encryptedPassword = encryptedPassword; // 保存加密后的密碼
AppDatabase.getInstance(RegisterActivity.this).userDao().insert(user);

?3.在登錄時(shí),通過如下代碼從數(shù)據(jù)庫中讀取用戶信息,并檢查密碼是否匹配:

String username = mEditTextUsername.getText().toString();
String password = mEditTextPassword.getText().toString();
User user = AppDatabase.getInstance(LoginActivity.this)
        .userDao()
        .findByUsername(username);
if (user == null) {
    Toast.makeText(LoginActivity.this, "用戶名不存在", Toast.LENGTH_SHORT).show();
} else if (EncryptionUtils.checkPassword(password, user.encryptedPassword)) { // 檢查密碼是否匹配
    Toast.makeText(LoginActivity.this, "登錄成功", Toast.LENGTH_SHORT).show();
} else {
    Toast.makeText(LoginActivity.this, "密碼錯(cuò)誤", Toast.LENGTH_SHORT).show();
}

? ? ? ?在上述代碼中,通過調(diào)用EncryptionUtils類的hashPassword()方法對密碼進(jìn)行哈希加密,并將加密后的密碼保存到數(shù)據(jù)庫中。而在登錄時(shí),則通過調(diào)用該類的checkPassword()方法檢查用戶輸入的密碼與數(shù)據(jù)庫中保存的加密后的密碼是否匹配。

? ? ?在實(shí)際應(yīng)用開發(fā)中處理用戶登錄注冊時(shí)需要注意的事項(xiàng)和建議:

  1. 密碼加密:對用戶密碼進(jìn)行哈希加密,并且不要使用明文存儲(chǔ)用戶密碼。
  2. 防止重復(fù)注冊:在用戶注冊時(shí)要保證用戶名/手機(jī)號(hào)/郵箱等唯—性。
  3. 用戶信息驗(yàn)證:在用戶登錄時(shí)要對用戶輸入的信息進(jìn)行驗(yàn)證,例如,檢查用戶名是否存在、密碼是否正確等。
  4. 記住登錄狀態(tài):在用戶登錄成功后,可以通過保存Token等方式來記錄用戶登錄狀態(tài),在用戶再次打開應(yīng)用或頁面時(shí)直接跳轉(zhuǎn)至已登錄的狀態(tài)。
  5. 安全退出:在用戶退出登錄時(shí),要及時(shí)清除緩存和Cookie等信息,并提示用戶已退出登錄。
  6. 隱私保護(hù):在處理用戶數(shù)據(jù)時(shí)要遵守相關(guān)法律法規(guī),保護(hù)用戶隱私不被泄露。

以上是登錄注冊處理中常見的一些注意事項(xiàng),此外也要結(jié)合具體業(yè)務(wù)場景進(jìn)行適當(dāng)?shù)恼{(diào)整和優(yōu)化。

額外:

要在 Android Studio 中實(shí)現(xiàn)點(diǎn)擊按鈕跳轉(zhuǎn)到另一個(gè) Activity,你需要按照以下步驟進(jìn)行操作:

  1. 首先,在你的項(xiàng)目中創(chuàng)建一個(gè)新的 Activity(比如 SecondActivity),用于跳轉(zhuǎn)后顯示的頁面??梢酝ㄟ^右鍵點(diǎn)擊項(xiàng)目文件夾 -> New -> Activity -> Empty Activity 來創(chuàng)建。

  2. 在你的源 Activity(即當(dāng)前頁面)的 XML 布局文件中,添加一個(gè)按鈕控件,并為其設(shè)置一個(gè)唯一的 android:id。例如:

<Button
    android:id="@+id/nextButton"
    android:text="跳轉(zhuǎn)到下一頁"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

?

? ?4. 打開源 Activity 的 Java 文件(即當(dāng)前頁面對應(yīng)的 Activity 類),在?onCreate?方法中找到按鈕,并為其設(shè)置點(diǎn)擊事件監(jiān)聽器。在監(jiān)聽器中,使用?Intent?實(shí)例來指定要跳轉(zhuǎn)到的目標(biāo) Activity。例如:

Button nextButton = findViewById(R.id.nextButton);
nextButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        Intent intent = new Intent(CurrentActivity.this, SecondActivity.class);
        startActivity(intent);
    }
});

確保將 CurrentActivity 替換為當(dāng)前頁面的類名,SecondActivity 替換為你創(chuàng)建的目標(biāo) Activity 的類名。

? ?5. 最后,在 AndroidManifest.xml 文件中,將第 3 步中創(chuàng)建的目標(biāo) Activity 添加為一個(gè)?<activity>?標(biāo)簽。確保?android:name?屬性的值與你創(chuàng)建的目標(biāo) Activity 類的名稱一致。例如:

?

<activity
    android:name=".SecondActivity"
    android:label="Second Activity" />

現(xiàn)在,當(dāng)用戶點(diǎn)擊源 Activity 的按鈕時(shí),就會(huì)啟動(dòng)目標(biāo) Activity,并跳轉(zhuǎn)到該頁面。?

學(xué)習(xí)使用Android Studio編寫登錄和注冊功能需要掌握以下幾個(gè)方面:

  1. 基礎(chǔ)知識(shí):熟悉Android開發(fā)基礎(chǔ)知識(shí),如布局、控件、事件處理等。

  2. UI設(shè)計(jì):關(guān)注良好的UI設(shè)計(jì)和用戶體驗(yàn),設(shè)計(jì)簡潔明了的界面并考慮不同設(shè)備屏幕的適配。

  3. 表單驗(yàn)證和數(shù)據(jù)處理:對用戶輸入進(jìn)行合法性驗(yàn)證,并采取相應(yīng)的處理措施。

  4. 數(shù)據(jù)存儲(chǔ):學(xué)習(xí)如何使用數(shù)據(jù)庫或本地存儲(chǔ)技術(shù)來保存和檢索用戶信息。

  5. 安全性考慮:保護(hù)用戶隱私和賬號(hào)安全,采取相應(yīng)的加密和安全處理措施。

  6. 邏輯處理和錯(cuò)誤處理:處理登錄和注冊過程中的邏輯流程,并提示用戶合適的錯(cuò)誤信息。

  7. 前后端交互:與后端服務(wù)器進(jìn)行數(shù)據(jù)交互,包括發(fā)送請求、解析響應(yīng)和處理網(wǎng)絡(luò)連接問題。

總的來說,學(xué)習(xí)使用Android Studio編寫登錄和注冊功能需要深入理解Android開發(fā)知識(shí),同時(shí)關(guān)注UI設(shè)計(jì)、數(shù)據(jù)處理、安全性和網(wǎng)絡(luò)交互等方面。通過不斷實(shí)踐和積累經(jīng)驗(yàn),可以逐漸掌握這一技能?。文章來源地址http://www.zghlxwxcb.cn/news/detail-744707.html

到了這里,關(guān)于Android Studio心得-創(chuàng)建登錄注冊項(xiàng)目的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Android studio連接MySQL并完成簡單的登錄注冊功能

    Android studio連接MySQL并完成簡單的登錄注冊功能

    近期需要完成一個(gè)Android項(xiàng)目,那先從與數(shù)據(jù)庫交互最簡單的登陸注冊開始吧,現(xiàn)記錄過程如下: 此篇文章的小demo主要涉及數(shù)據(jù)庫的連接,以及相應(yīng)信息的查找與插入。 我已將源碼上傳至GitHub: https://github.com/changyan-maker/LoginApp 首先展示一下完成效果。 數(shù)據(jù)庫設(shè)計(jì): 數(shù)據(jù)庫

    2024年01月17日
    瀏覽(25)
  • Android Studio|使用SqLite實(shí)現(xiàn)一個(gè)簡單的登錄注冊功能

    Android Studio|使用SqLite實(shí)現(xiàn)一個(gè)簡單的登錄注冊功能

    本學(xué)期學(xué)習(xí)了Android Studio這門課程,本次使用Android Studio自帶的sqlite數(shù)據(jù)庫實(shí)現(xiàn)一個(gè)簡單的登錄注冊功能。 目錄 一、了解什么是Android Studio? 二、了解什么是sqlite? 三、創(chuàng)建項(xiàng)目文件 ?四、創(chuàng)建活動(dòng)文件和布局文件。 五、創(chuàng)建數(shù)據(jù)庫,連接數(shù)據(jù)庫 ?六、創(chuàng)建實(shí)體類,實(shí)現(xiàn)注

    2024年02月06日
    瀏覽(51)
  • 用Android Studio編寫一個(gè)登錄界面和注冊界面并可以跳轉(zhuǎn)

    下面是使用 Android Studio 編寫一個(gè)簡單的登錄界面和注冊界面,并實(shí)現(xiàn)跳轉(zhuǎn)的示例代碼。 首先,在 res/layout 目錄下創(chuàng)建一個(gè)名為 activity_login.xml 的布局文件,作為登錄界面的布局: 接下來,在 res/layout 目錄下創(chuàng)建一個(gè)名為 activity_register.xml 的布局文件,作為注冊界面的布局:

    2024年04月09日
    瀏覽(33)
  • Android Studio課程心得

    Android Studio課程心得

    Android Studio 課程是我學(xué)習(xí) Android 開發(fā)過程中的一次非常寶貴的經(jīng)歷。在這門課程中,我學(xué)習(xí)了如何使用 Android Studio 進(jìn)行 Android 應(yīng)用程序的開發(fā),并且通過完成項(xiàng)目和作業(yè)來實(shí)踐和鞏固所學(xué)知識(shí)。在學(xué)習(xí)的過程中我遇到了一些困難,但是通過不斷地嘗試和探索,最終我都找到了

    2024年02月02日
    瀏覽(17)
  • ffmpeg-android studio創(chuàng)建jni項(xiàng)目

    ffmpeg-android studio創(chuàng)建jni項(xiàng)目

    android - defaultConfig -externalNativeBuild - cmake 配置c++使用標(biāo)準(zhǔn) android - externalNativeBuild - cmake 1 、配置cmake文件路徑 2、配置cmake的版本 cmake_minimum_required cmake最低版本要求 project 設(shè)置項(xiàng)目名稱 add_library 添加庫并設(shè)置庫的源文件 1、 Normal Libraries name:庫名稱 STATIC|SHARED|MODULE:庫類型(靜態(tài)

    2024年02月09日
    瀏覽(22)
  • Flutter在Android Studio上創(chuàng)建項(xiàng)目與構(gòu)建模式

    Flutter在Android Studio上創(chuàng)建項(xiàng)目與構(gòu)建模式

    一、安裝插件 ? ? 1、前提條件,安裝配置好Android Studio環(huán)境 ? ? 2、安裝Flutter和Dart插件 ? ?? ? ? Linux或者Windows平臺(tái): 1)、打開 File ?? Settings。 2)、在左側(cè)列表中,選擇 \\\" Plugins \\\" 右側(cè)上方面板選中 ?\\\"Marketplace\\\" 在搜索框中輸入“flutter”,選擇Flutter插件,點(diǎn)擊“Install”安

    2024年02月04日
    瀏覽(34)
  • Android Studio 創(chuàng)建項(xiàng)目不自動(dòng)生成BuildConfig文件

    Android Studio 創(chuàng)建項(xiàng)目不自動(dòng)生成BuildConfig文件

    今天在AS上新建項(xiàng)目發(fā)現(xiàn)找不到BuildConfig文件,怎么clear都不行。通過多方面查找發(fā)現(xiàn)原來gradle版本不同造成的,Gradle 8.0默認(rèn)不生成 BuildConfig 文件。 如上圖,8.0版本是沒有source文件夾 上圖是低于8.0版本有source文件夾 針對這個(gè)問題,有兩種解決辦法 ?????? 方法一:降低Gr

    2024年01月22日
    瀏覽(23)
  • Android Studio 2022.1.1創(chuàng)建項(xiàng)目的Gradle配置

    Android Studio 2022.1.1創(chuàng)建項(xiàng)目的Gradle配置

    今天使用Android Studio建了一個(gè)新項(xiàng)目,遇到了不少問題,網(wǎng)上也找了不少解決方案都無效(可能Studio版本、項(xiàng)目版本等都不一樣,解決辦法也不一樣吧),最后問題解決,總結(jié)梳理以下幾點(diǎn): Android Studio版本:2022.1.1 Gradle版本:7.5 Android Gradle Plugin Version:7.4.2 JDK版本:Java?1

    2024年02月06日
    瀏覽(24)
  • 【安卓app開發(fā)一】Android Studio + Bmob后端云實(shí)現(xiàn)注冊&登錄賬號(hào)、密碼找回、意見反饋及數(shù)據(jù)可視化

    【安卓app開發(fā)一】Android Studio + Bmob后端云實(shí)現(xiàn)注冊&登錄賬號(hào)、密碼找回、意見反饋及數(shù)據(jù)可視化

    目錄 前言 概覽 Bmob后端云介紹 Bmob后端云與Android Studio配置 一、Bmob后端云 ?二、Android Studio配置 工具類 一、User類 二、Suit類 三、Code類 實(shí)現(xiàn)類 ?一、登錄代碼 ?二、注冊代碼 ?三、找回密碼代碼 ?四、想法反饋代碼 ? ? ? ? 本項(xiàng)目尚在開發(fā)階段,主要針對的是安卓用戶,通

    2024年02月08日
    瀏覽(26)
  • Android studio心得——fragment動(dòng)態(tài)加載

    Android studio心得——fragment動(dòng)態(tài)加載

    在Android應(yīng)用程序中,F(xiàn)ragment是一種可以嵌入Activity中的組件。通過 Fragment,我們可以將UI 目錄 前言 一、什么是Android Studio 二、簡介Fragment 三、學(xué)期知識(shí)匯總 四、什么是碎片(Fragment) 五、頁面實(shí)現(xiàn)步驟 1.程序APP主界面的常用例子 2.定義4個(gè)Fragment 3.activity_main.xml代碼展示 4.四個(gè)

    2024年02月09日
    瀏覽(30)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包