Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find property 'VERSION_CODE'

Tags:

android

gradle

I want to use this library for my project and I got error when I try open this library (FloatingActionButton) source from Github.

I download as zip this project when I tried to open the source code to understand it, I got this error:

Error:(10, 0) Could not find property 'VERSION_CODE' on project ':library'.

Add build.gradle

apply plugin: 'com.android.library'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 22
        versionCode Integer.parseInt(project.VERSION_CODE)
        versionName project.VERSION_NAME
    }
    buildTypes {
        release {
            minifyEnabled false
            debuggable false
        }

        debug {
            minifyEnabled false
            debuggable true
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

apply from: '../gradle-mvn-push.gradle'
like image 613
Artem Avatar asked Jan 08 '23 22:01

Artem


2 Answers

import library as a module, change versionCode and versionName to random values, add a reference to your project - add to dependencies compile project(":library") and remove:

apply from: '../gradle-mvn-push.gradle'

like image 76
Viktor Yakunin Avatar answered Jan 19 '23 06:01

Viktor Yakunin


To use new design support library yout need to write following line in your app's gradle file

compile 'com.android.support:design:22.2.0'

and in your layout.xml file write following lines

 <android.support.design.widget.FloatingActionButton
        android:id="@+id/floating_action_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/fab_margin"
        android:src="@drawable/your_icon"
        app:borderWidth="0dp"
        app:layout_anchor="@id/coordinator_layout"
        app:layout_anchorGravity="bottom|right|end"
        />

Thats it

like image 29
Jaykishan Sewak Avatar answered Jan 19 '23 06:01

Jaykishan Sewak