Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unresolved class in the Android Manifest #132

Open
0111101010110 opened this issue Dec 28, 2022 · 0 comments
Open

Unresolved class in the Android Manifest #132

0111101010110 opened this issue Dec 28, 2022 · 0 comments

Comments

@0111101010110
Copy link

I've tried everything and still get an error. It is an emergency; I have to finish this thing in two days. Help me, please.

== Manifest ==

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
    android:allowBackup="true"
    android:dataExtractionRules="@xml/data_extraction_rules"
    android:fullBackupContent="@xml/backup_rules"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    tools:targetApi="31"
    android:theme="@style/Theme.RetryChooseDirectory">
    <activity
        android:name=".MainActivity"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <meta-data
            android:name="android.app.lib_name"
            android:value="" />
    </activity>

    <activity android:name="net.rdrei.android.dirchooser.DirectoryChooserActivity"/>
</application>

== build.gradle ==
plugins {
id 'com.android.application'
}

android {
namespace 'com.example.retrychoosedirectory'
compileSdk 32

defaultConfig {
    applicationId "com.example.retrychoosedirectory"
    minSdk 26
    targetSdk 32
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

}

dependencies {

implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

implementation 'net.rdrei.android.dirchooser:library:3.2@aar'   // ...

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'

}

== Main Activity ==
package com.example.retrychoosedirectory;

import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import net.rdrei.android.dirchooser.DirectoryChooserActivity;
import net.rdrei.android.dirchooser.DirectoryChooserConfig;

public class MainActivity extends AppCompatActivity
{
// Global variable
private Button clickButton;
private final Intent chooserIntent = new Intent(this, DirectoryChooserActivity.class);
private static final String TAG = "MainActivity";
private final DirectoryChooserConfig config = DirectoryChooserConfig.builder()
.newDirectoryName("DirChooserSample")
.allowReadOnlyDirectory(true)
.allowNewDirectoryNameModification(true)
.build();

// Life Cycle
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    clickButton = findViewById(R.id.button);

    ActivityResultLauncher<Intent> startActivityForResult = registerForActivityResult(
        new ActivityResultContracts.StartActivityForResult(),
        new ActivityResultCallback<ActivityResult>()
        {
            @Override
            public void onActivityResult(ActivityResult result)
            {
                if(result.getResultCode() == DirectoryChooserActivity.RESULT_CODE_DIR_SELECTED)
                {
                    Intent idk = result.getData();
                    Log.d(TAG, " >> idk = " + idk);
                }
            }
        }
    );

    chooserIntent.putExtra(DirectoryChooserActivity.EXTRA_CONFIG, config);

    clickButton.setOnClickListener(new View.OnClickListener()
    {
        @Override
        public void onClick(View view)
        {
            startActivityForResult.launch(chooserIntent);
        }
    });
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant