0

I am trying to develop an SFTP client using sshj on Android studio such that the App can connect securely to the server using SFTP over ssh. The code was running fine, but when I added the "sshj-0.10.0" module, it gives me this complicated error.

enter image description here

The "sshj-0.10.0" module is needed to run server code using net library as below:

import net.schmizz.sshj.SSHClient;
import net.schmizz.sshj.sftp.SFTPClient;

I added the module the project and configured it in the dependencies in build.gradel of the app as shown below:

enter image description here

What I have tried so far (but not limited to):

1- Clean Project then Rebuild Project - failed

2- Invalidate Caches / Restart - failed

3- Delete .gradle and .idea from my root project- failed

4- Added

android {
    defaultConfig {
    multiDexEnabled true
      }
   }

and

dependencies {// Multidex
implementation 'com.android.support:multidex:1.0.3'
implementation project(path: ':sshj-0.10.0')
}

No solution was worked with me.

Here is my build.gradle(:app)

apply plugin: 'com.android.application'

 android {
    compileSdkVersion 28
     defaultConfig {
      applicationId "com.example.mohsenali.autosen"
    minSdkVersion 23
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
    release {
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
       }
    }
   }


  android {
     defaultConfig {
    multiDexEnabled true
     }
   }


    dependencies {
       implementation fileTree(dir: 'libs', include: ['*.jar'])
       implementation 'com.android.support:appcompat-v7:28.0.0'
       implementation 'com.android.support.constraint:constraint-layout:2.0.2'
       testImplementation 'junit:junit:4.12'
       androidTestImplementation 'com.android.support.test:runner:1.0.2'
       androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
      //TedPermission
       implementation 'gun0912.ted:tedpermission:1.0.3'
       implementation files('D:/SKKU_PhD/Android/workspace_2018_projects/AutoSen/app/libs/commons-net-3.7.1.jar')
// Multidex
       implementation 'com.android.support:multidex:1.0.3'
       implementation project(path: ':sshj-0.10.0')

       }

I know that this kind of error is popular but I tried many possible solutions available on SO since two days ago but none of them has helped me. So please don't mark it duplicated, maybe someone could help. Thanks.

Mohsen Ali
  • 655
  • 1
  • 9
  • 30

1 Answers1

0

Finally, I solved this error bu creating "libs" folder in the root of "app" project, and added the .jar library to it. After that I updated the code in "build.gradle(:app)" by adding this line: "implementation files('path to/app/libs/jsch-0.1.55.jar')".

Mohsen Ali
  • 655
  • 1
  • 9
  • 30