This is the 26th day of my participation in the August Text Challenge.More challenges in August

1. Android storage path

In normal development we will save the file in the appropriate directory, but do we know which directory we are saving to? Are we storing it correctly according to the storage rules?

1. External memory card (SD card)

  • The root directory of the SD card is /storage/emulated/0
Environment.getExternalStorageDirectory()
Copy the code

2, directory to/storage/emulated / 0 / Android/data/packagename/cache

  • (Packagename indicates the name of the application package.)
getExternalCacheDir()
Copy the code

3, directory to/storage/emulated / 0 / Android/data/packagename/files

getExternalFilesDir(null)
Copy the code

4. Internal storage (internal storage of mobile phones)

  • Directory to/data
getDataDir()
Copy the code

5, the application cache directory/data/data/packagename/cache

getCacheDir()
Copy the code

6, application file directory/data/data/packagename/files

getFilesDir()
Copy the code

The getCacheDir and getFilesDir directories must be root’s phone to be seen in the file operating system. If you delete data from the application or uninstall the application, the files in these directories will also be deleted.

GetExternalCacheDir () and getExternalFilesDir(null) are visible on the Android/data/packagename file system. If the application is uninstalled, the files in this directory will be deleted.

Environment. External.getexternalstoragedirectory () directory created files will not be removed by uninstall program.

2. AndroidStudio Terminal

gradlew  assembleDebug  –stacktrace

View the dependencies used

Execution failed for task ‘:app:transformClassesWithMultidexlistForDebug’.

com.android.build.api.transform.TransformException: Error while generating the main dex list

This problem is mostly caused by dependence on repetition

In Android Studio Terminal, type gradlew assembleDebug — stackTrace

To find out what the problem is

Such as:

Caused by: com.android.tools.r8.errors.CompilationError: Program type already present: it.s

ephiroth.android.library.imagezoom.ImageViewTouch$OnImageViewTouchDoubleTapListener It. Sephiroth. Android. Library. Imagezoom. This package repeats.

Solutions:

1. Add two:

Just delete one.

2, if there is a reference in the third package, and introduce their own (in which third party this is not easy to find, with conscious)

Delete from your own or from a third party

api  ('com.xxx.xxxx.xxx'){
    exclude group: 'it.sephiroth.android.library.imagezoom'
}
Copy the code

FAQ:

Run with -- stackTrace option to get the stacktrace. Run with --info or --debu Run with -- stackTrace option to get the stack trace. Run with --info or --debug option to get more log output. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.Copy the code

It’s basically asking you to view more log information. Go to the root directory of your project, for example, MyApplication, and run it under DOS

gradlew compileDebug --stacktrace
Copy the code

If the above command does not work, try using the following command

gradle compileDebug --stacktrace
Copy the code

You can see a lot of error messages coming out.

Command list:

gradlew compileDebug --stacktrace  or
gradle compileDebug --stacktrace 
gradlew compileDebug --info
gradlew compileDebug --debug
Copy the code