简体   繁体   中英

Android Project Structure Changed After Gradle Sync

I am working with android studio attempting to implement the following github within my own application

https://github.com/jhansireddy/AndroidScannerDemo

When following the instructions I add the following line to the gradle

compile project(':scanlibrary')

After adding the above i then sync the gradle and the whole project structure changes, to the point where i no longer recognise it

Original Project Structure原始项目结构

New Project Structure新项目结构

If you havnt gathered i am fairly new to the whole android programming thing

One thought i had was that the git project uses OpenCV and it was related to this, however i have not manually installed OpenCV

You have to import scan library to bring project structure to normal. Follow these steps:

1 - Download zip from this link .

2 - Extract it and copy location of scanlibrary project present inside ScanDemoExample. In my case it is like (D:\\Amrit\\AndroidScannerDemo-master\\AndroidScannerDemo-master\\ScanDemoExample\\scanlibrary) .

3 - Now come back to Android Studio, select

File -> New -> Import Module

and paste copied location path from previous step in source directory which will result in module name :scanlibrary . Click on Finish to close the dialog.

4 - Now your project structure will look like image below. (You can view it by selecting File -> Project Structure). 扫描库demo的项目结构

5 - Don't forget to add dependency

compile project(':scanlibrary') 

inside build.gradle file.

6 - Now your library is ready to use with your project. In case you are facing any errors try cleaning & rebuilding your project. And more often errors are import problem so try including these imports :

import com.scanlibrary.ScanActivity;
import com.scanlibrary.ScanConstants;

where ScanActivity & ScanConstants are classes present inside scanlibrary.

Let me know if you have any doubts. Happy coding!

add this depenedency in build.gradle

implementation 'com.github.neutrinosplatform:scanlibrary:3.3'

and add maven in repositories

maven { url 'https://jitpack.io' }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM