2016-08-10 8 views
1

私のレルムをアプリケーションに追加しようとしています。彼らのドキュメントでは、クラスパスの依存関係をプロジェクトレベルのbuild.gradleファイルに追加する必要があると述べています。また、realm-androidプラグインをトップアプリケーションアプリケーションレベルのbuild.gradleファイルに適用します。 (https://realm.io/docs/java/latest/NDKでgradleで動作しないプラグインを適用する

私はそれをやったが、私はこのエラーを取得しています:

Error:(2, 0) 'com.android.application' or 'com.android.library' plugin required. 

マイプロジェクトのGradle:

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle-experimental:0.7.0-alpha4' 
     classpath "io.realm:realm-gradle-plugin:1.1.1" 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

マイアプリのGradleのは、NDKを使用しています。

apply plugin: 'com.android.model.application' 
apply plugin: 'realm-android' 


Properties properties = new Properties() 
properties.load(project.rootProject.file('local.properties').newDataInputStream()) 
def superpowered_sdk_path = properties.getProperty('superpowered.dir') 

model { 
    repositories { 
     libs(PrebuiltLibraries) { 
      superpowered { // this is where you declare the "superpowered" static library 
       headers.srcDir "${superpowered_sdk_path}" 
       binaries.withType(StaticLibraryBinary) { // attaching library files to each platform 
        def platformName = targetPlatform.getName() 
        if (platformName == "armeabi-v7a") { 
         staticLibraryFile = file("${superpowered_sdk_path}/libSuperpoweredAndroidARM.a") 
        } else if (platformName == "arm64-v8a") { 
         staticLibraryFile = file("${superpowered_sdk_path}/libSuperpoweredAndroidARM64.a") 
        } else if (platformName == "x86") { 
         staticLibraryFile = file("${superpowered_sdk_path}/libSuperpoweredAndroidX86.a") 
        } else if (platformName == "x86_64") { 
         staticLibraryFile = file("${superpowered_sdk_path}/libSuperpoweredAndroidX86_64.a") 
        } 
       } 
      } 
     } 
    } 

    android { // main settings for your application 
     compileSdkVersion = 23 
     buildToolsVersion = "23.0.2" 


     defaultConfig { 
      applicationId "com.superpowered.crossexample" 
      minSdkVersion.apiLevel = 16 // more than 95% of all active Android devices 
      targetSdkVersion.apiLevel = 23 
      versionCode 1 
      versionName "1.0" 
     } 
    } 

    android.ndk { // your application's native layer parameters 
     moduleName = "SuperpoweredExample" 
     platformVersion = 16 
     stl = "c++_static" 
     CFlags.addAll(["-O3", "-fsigned-char"]) // full optimization, char data type is signed 
     cppFlags.addAll(["-fsigned-char", "-I${superpowered_sdk_path}".toString()]) 
     ldLibs.addAll(["log", "android", "OpenSLES"]) // load these libraries: log, android, OpenSL ES (for audio) 
     abiFilters.addAll(["armeabi-v7a", "arm64-v8a", "x86", "x86_64"]) // these platforms cover 99% percent of all Android devices 
    } 

    android.sources.main.jni { 
     source { 
      srcDir "jni" 
      srcDir "${superpowered_sdk_path}/AndroidIO" 
     } 
     dependencies { 
      library "superpowered" linkage "static" // this is where you attach the "superpowered" static library to your app 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:appcompat-v7:23.4.0' 
    compile 'com.facebook.fresco:fresco:0.12.0' 
    compile 'com.android.support:design:23.4.0' 
} 
+0

Realmは実験用プラグインでは機能しませんが、Gradle CMakeサポートでは機能しますが、注意してください。 [here](https://github.com/googlesamples/android-ndk/tree/master-cmake)のサンプルコードを参照してください。 – EpicPandaForce

+0

同じ問題ですが、他の解決策を見つけましたか? – vrbsm

答えて

0

に見えます実験的なプラグインを使用しているようですか? apply plugin: 'com.android.model.application'。あれは正しいですか?

現在、レルムは実験プラグインでは機能しません。 https://github.com/realm/realm-java/issues/2539

関連する問題