Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Device File Explorer run-as:Package 'my project name' is unknown

Tags:

java

android

I am using Android Studio 3.0 and I want to access a sqlite db, so I want to download the db inside data/data/project, but when I connect an android phone and open project folder then this happen, run-as: Package 'my project' is unknown.

Device's package directory on real device:

enter image description here

But when I use the emulator to do this, everything is fine.

Does anyone know why is it?

Device's package directory on emulator:

enter image description here

Thanks a lot!

like image 658
彭彥雄 Avatar asked Mar 13 '18 08:03

彭彥雄


People also ask

How do I create a project in Android Studio?

When you start a new project, Android Studio creates the necessary structure for all your files and makes them visible in the Project window on the left side of the IDE (click View > Tool Windows > Project ). This page provides an overview of the key components inside your project.

What is the device file explorer on Android?

The Device File Explorer allows you to view, copy, and delete files on an Android device. This is useful when examining files that are created by your app or if you want to transfer files to and from a device.

What is an app module in Android Studio?

When you create a new project, the default module name is "app". In the Create New Module window, Android Studio offers the following types of app modules: Each provides essential files and some code templates that are appropriate for the corresponding app or device type.

How to open a file or directory in Android Studio?

Right-click on a file or directory to create a new file or directory, save the selected file or directory to your machine, upload, delete, or synchronize. Double-click a file to open it in Android Studio.


1 Answers

For security reason, it's not allowed.
You can do it only on emulator or rooted device.

But you can add needed files in assets, so these are included in APK.

build.gradle:

android {
  sourceSets.main {
    assets.srcDir '/absolute/path/to/your/assets/folder'
  }
}
like image 188
Pico12 Avatar answered Oct 01 '22 05:10

Pico12