ソース掲示板




すべてから検索

キーワード   条件 表示 現行ログ 過去ログ トピックス 名前 本文

  メンテナンス 前画面に戻る

対象スレッド 件名: Android Bind : WevView + Gson + PHP
名前: lightbox
処理選択
パスワード

件名 Android Bind : WevView + Gson + PHP
名前 lightbox
コメント
[[build.gradle (プロジェクト)]]
@DIV
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
        @c:red(classpath 'com.android.databinding:dataBinder:1.0-rc1')
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

※ Android Studio 1.4
※ 実機 Abdroid 4.4.4

[[build.gradle (モジュール)]]
@SHOW
先頭に apply plugin を追加します

apply plugin: 'com.android.application'
@c:red(apply plugin: 'com.android.databinding')
@END

[[Google Gson]]
@SHOW
https://github.com/google/gson

app\libs に jarをダウンロードして、プロジェクトツリーより jar を右クリックして、Add As Library を実行します

https://lh3.googleusercontent.com/-1212o01qfIU/ViGU_XH4q-I/AAAAAAAAcGk/FdWRZL1q3qc/s400-Ic42/_img.jpg
@END

※ app はプロジェクトの初期モジュール名で、Refactor でhttp://matome.naver.jp/odai/2144307890400980801(変更できます)
※ Add As Library が見当たらない場合は、Open Module Settings の dependencies タブで追加します

https://lh3.googleusercontent.com/-7lvwsRsT3T0/ViGVi6vQaCI/AAAAAAAAcGs/CcbtFobl0ko/s400-Ic42/_img.png

※ build.gradle に直接追加してもかまいません

[[build.gradle (app) の該当部分]]
@DIV
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:22.2.1'
    [[compile files('libs/gson-2.4.jar')]]
}
@END

[[全体]]
@DIV
apply plugin: 'com.android.application'
@c:red(apply plugin: 'com.android.databinding')

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.0"

    defaultConfig {
        applicationId "sample.lightbox.androidbind1017"
        @c:red(minSdkVersion 19)
        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'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:22.2.1'
    @c:red(compile files)('libs/gson-2.4.jar')
}
@END

[[AndroidManifest.xml]]
@DIV
<uses-permission android:name="android.permission.INTERNET"/>
@END
※ WebView に必要なので追加します