working of tesseract,(tess-two,eyes-two) and its gradle errors with default config in android studio - android-studio

Iam trying to use tessearct for an image based compiler App.
I have created a library under the main project which contains both tess-two and eyes-two files.
Iam having problems in building their build.gradle files
THE PROJECT'S Root build.gradle file
enter // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
The project's module:app/build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc3"
defaultConfig {
applicationId "com.example.pavithra.ocrreader"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile project (':libraries:eyes-two')
compile project (':libraries:tess-two')
}
now the project's setting.gradle
include ':app'
include ':libraries:eyes-two'
include ':libraries:tess-two'
tess-two's build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:1.2.3"
}
}
apply plugin: "android-library"
android {
compileSdkVersion 22
buildToolsVersion '23.0.0 rc3'
defaultConfig {
minSdkVersion 15
targetSdkVersion 22
}
sourceSets.main {
manifest.srcFile "AndroidManifest.xml"
java.srcDirs = ["src"]
resources.srcDirs = ["src"]
res.srcDirs = ["res"]
jniLibs.srcDirs = ["libs"]
}
eyes-two build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:1.2.3"
}
}
apply plugin: "android-library"
android {
compileSdkVersion 22
buildToolsVersion '23.0.0 rc3'
defaultConfig {
minSdkVersion 15
targetSdkVersion 22
}
sourceSets.main {
manifest.srcFile "AndroidManifest.xml"
java.srcDirs = ["src"]
resources.srcDirs = ["src"]
res.srcDirs = ["res"]
jniLibs.srcDirs = ["libs"]
}
Now when i build this, Android studio throws an error saying:
Error:A problem occurred configuring project ':app'.
> Cannot evaluate module eyes-two : Configuration with name 'default' not found.
This is really taking me no where Can anyone PLEASE HELP me with it as i have my submission in a day ! please.
Also with the build.gradle files with respect to eyes-to and tess-two
Thank you in advance.

Add the following lines to your settings.gradle file
project(':tess-two').projectDir = new File('libraries/tess-two')
project(':eyes-two').projectDir = new File('libraries/eyes-two')

Related

Design view not getting displayed on Android Studio

I just imported a project, but when i try to enter design view this shows up:
My current gradle version is the latest 26.0.2 by the way. I'm not sure what to do, anyone have an idea?
Here are some Gradle Scripts:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion
defaultConfig {
applicationId "com.example.Ron.myapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
and
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I solved the problem myself. I upgraded the compileSdkVersion aswell as the minSdkVersion along with the dependencies. It now looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion
defaultConfig {
applicationId "com.example.Ron.myapp"
minSdkVersion 18
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:design:26.0.2'
compile 'com.android.support:cardview-v7:26.0.2'
}
please update your support lib and compileSdkVersion like below.
compileSdkVersion = 25
buildToolsVersion = "25.0.2"
minSdkVersion = 18
// Library versions
supportLibraryVersion = "25.0.0"
also add ConstraintLauout gradle in gradle file.
compile 'com.android.support.constraint:constraint-layout:1.0.2'
For More details please check : https://stackoverflow.com/a/45115111/1343788
known problem
just add
compile 'com.android.support.constraint:constraint-layout:1.0.2'
in your gradle file,
it will fix it

Error:(20,0)Could not find method compile() for arguments [file collection]

Below are my gradle files..
so here is the error which i get when i sync the project:-Error:(20, 0) Could not find method compile() for arguments [file collection] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Open File
Following is my app gradle...
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.sinch.workshopskeleton"
minSdkVersion 9
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:20.0.+'
compile files('libs/sinch-android-rtc-3.3.5.jar')
}
Following is my project gradle
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
dependencies {
compile files('app/libs/sinch-android-rtc-3.11.1.jar')
}
Remove below lines from your project's build gradle and it will work fine.
You can add this in your app level build gradle.
dependencies {
compile files('app/libs/sinch-android-rtc-3.11.1.jar')
}

Android Studio cannot resolve dependency

I use Android studio to create a blank project, but cannot compile.
below is its error:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration':app:_debugUnitTestApkCopy'.
> Could not resolve junit:junit:4.12.
Required by:
project :app
> Could not resolve junit:junit:4.12.
> Could not get resource 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'.
> Could not GET 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'.
> jcenter.bintray.com:443 failed to respond
I tried to use a proxy
and checked proxy settings with the failed url 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'
and it show me success
but when I compile the project, it's still the same error.
this is my gradle.properties file:
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=1080
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=1080
this is project build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
this is app build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
testCompile 'junit:junit:4.12'
}
finally, I solved my question
the proxy I use is a sockts5 proxy
the autogenerate gradle.properties file use a http proxy
after I change the gradle.properties it's worked
this is my new gradle.properties:
org.gradle.jvmargs=-Xmx1536m -DsocksProxyHost=127.0.0.1 -DsocksProxyPort=1080

Showing error fix plugin version and sync projects in android studio

i am new in Android Studioand when i create a new project suddenly i just got an error message i.e, Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "9ba5989c7b283b0ec145cc20641f7155619d6148"
Here is my build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "************"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}
My build.gradle(project)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
i have updated my Android studio 2.0 but it always showing Fix plugin version and sync project when open create a project.please anyone can tell me what i should do to rectify this problem.
Thanks in advance...
classpath 'com.android.tools.build:gradle:2.0.0-alpha2' instead of this use
classpath 'com.android.tools.build:gradle:2.2.+' this fixed the same error for me!

Plugin with id 'crashlytics' not found issue with Android studio latest plugin

For the following gradle build configuration, I am facing Error:(11, 0) Plugin with id 'crashlytics' not found error.
buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
}
}
apply plugin: 'android'
apply plugin: 'crashlytics'
apply plugin: 'hugo'
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
android {
compileSdkVersion 19
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "com.wiznsystems.android"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/smartconfiglib.jar')
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'com.android.support:support-v4:19.+'
compile 'com.google.android.gms:play-services:4.2.42'
compile 'com.jakewharton.hugo:hugo-runtime:1.1.0'
compile 'com.squareup.retrofit:retrofit:1.+'
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.jakewharton:butterknife:5.+'
compile 'de.greenrobot:eventbus:2.2.1'
compile 'fr.avianey:facebook-android-api:+#aar'
compile 'com.squareup.picasso:picasso:2.+'
compile 'de.keyboardsurfer.android.widget:crouton:1.8.4'
compile project(':apptentiveandroidsdk')
}
Am I doing something wrong? or Is there any workaround for making it build?
I had the same issue. What I ended up doing was putting the order of the commands inline with what Crashlytics provided. I had something similar to yours and it didn't work. Once it changed it to the exact order of there docs it worked. Here is what mine looks like now. Hope this helps.
buildscript {
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'android'
apply plugin: 'crashlytics'
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.android.support:support-v4:19.0.+'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.joanzapata.android:android-iconify:1.0.6'
compile 'com.github.hotchemi:android-rate:0.3.1'
compile 'com.loopj.android:android-async-http:1.4.5'
compile 'com.github.satyan:sugar:1.3'
compile 'com.crashlytics.android:crashlytics:1.+'
}
android {
compileSdkVersion 19
buildToolsVersion "20"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
Try informing the classpath dependency:
buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
After battling with this error for hours, I ended up deleting the ".gradle" folder on my home directory, and the issue vanished! So, if you are getting this issue, try deleting the .gradle folder first, then rebuild your project.

Resources