I was trying to run Apache Flink within an Android App. I just want to run a minimum working example, like this:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); runFlinkExample(); } private void runFlinkExample() { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); DataStream<Integer> stream = env.fromCollection(Arrays.asList(1, 2, 3, 4, 5)); stream.print(); try { env.execute(); } catch (Exception e) { e.printStackTrace(); } } These are my two .gradle files: build.gradle (Module) plugins { id 'com.android.application' } android { compileSdkVersion 30 buildToolsVersion "30.0.3" defaultConfig { applicationId "com.example.flink" minSdkVersion 26 targetSdkVersion 30 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'reference.conf' } } dependencies { implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'com.google.android.material:material:1.3.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' // Flink implementation 'org.apache.flink:flink-streaming-java_2.12:1.12.1' implementation 'org.apache.flink:flink-clients_2.12:1.12.1' } 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:4.1.2" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } The first problem is, that I get the following Error: Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.flink.streaming.api.environment.StreamExecutionEnvironment" on path: DexPathList[[zip file "/data/app/~~DbT_CZ7AhLED2xZgLBk .... In cases there this error doesn't appear, I get Akka-Actor errors, because I must exclude 'reference.conf', otherwise the code wouldn't compile. However, this leads to more exceptions, e.g. missing akka-version. So my general question is: Is it possible to run Flink within an Android-App? Or is this not possible (recommended)? Perhaps someone knows how to modfiy my gradle files (or something else) to run my example. Or perhaps someone already has successfully used Flink in Android.