AnyChart / AnyChart-Android

AnyChart Android Chart is an amazing data visualization library for easily creating interactive charts in Android apps. It runs on API 19+ (Android 4.4) and features dozens of built-in chart types.
2.32k stars 369 forks source link

I can't find aar file #81

Open ashivakarthik opened 5 years ago

ashivakarthik commented 5 years ago

I can't find aar file in this also

https://github.com/AnyChart/AnyChart-Android/raw/master/builds/anychart-library.aar

imaximova commented 5 years ago

@ashivakarthik All you need to make the AnyChart Android work is right here: https://github.com/AnyChart/AnyChart-Android/tree/master. This is the actual build, please use it.

Aelafseged commented 5 years ago

wait @imaximova ... i don't get it ... u mean we need to build it? or what?

Shestac92 commented 5 years ago

@ashivakarthik There's no need in building the repo. All you need is to add the repository to the project build.gradle and add the dependency to the module build.gradle. For details, check the Getting Started article.

ghost commented 4 years ago

Doesnt work.

Shestac92 commented 4 years ago

@diaconori Please, can you provide more details about the issue? We will check it.

ghost commented 4 years ago

@Shestac92, I'll list it as following:


Build.Gradle (:app):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.XXXXXX.XXXX"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

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

}

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

    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'com.github.AnyChart:AnyChart-Android:1.1.2'
    implementation 'com.android.support:multidex:1.0.3'
}

Build.Gradle (project):

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

fragment_home.xml:

<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".home.HomeFragment">

<com.anychart.AnyChartView android:id="@+id/any_chart_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />


MainActivity.java:

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Toolbar toolbar = findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        AnyChartView chart = findViewById(R.id.any_chart_view);
        Pie pie = AnyChart.pie();

        List<DataEntry> data = new ArrayList<>();
        data.add(new ValueDataEntry("John", 10000));
        data.add(new ValueDataEntry("Jake", 12000));
        data.add(new ValueDataEntry("Peter", 18000));

        chart.setChart(pie);

        BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation);
        bottomNavigationView.setOnNavigationItemSelectedListener(navListener);
        getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new HomeFragment()).commit();
    }

Exception: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.anychart.AnyChartView$JsListener com.anychart.AnyChartView.getJsListener()' on a null object reference at com.anychart.APIlib.addJSLine(APIlib.java:27) at com.anychart.charts.Pie.(Pie.java:34) at com.anychart.AnyChart.pie(AnyChart.java:130)

NONE of the StackOverflow answers have a solution to this fix. It throws the NullPointerException at: Pie pie = AnyChart.pie();

image

kushalsharma12 commented 2 years ago

A similar issue I am facing... I had added their dependency but anychart is not at all invoking in the xml and in the main activity. @diaconori you got the answer???