Android NDK学习笔记

1.配置在C/C++中打印log日志:

1).在c/c++文件中定义如下:

//配置log日志信息
#include <android/log.h>
#define TAG "asmine"
#define LOGV(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
  • log.h文件在ndk目录下的platforms/android-version/log.h,其中包含了所有有关log日志输出的相关信息,可以据此修改log日志级别
  • TAG “asmine”定义一个log输出的tag name
  • LOGV()为log日志输出函数

Dagger2学习笔记

1.Dagger在Android Studio中的环境配置:

1).在build.gradle(Project)中配置:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4' //add this line

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

Android开发过程中问题记录

1.启动eclipse出现:An error occurred while automatically activating bundle com.android.ide.eclipse.adt

解决方式:命令行到eclipse目录下运行exlipse.exe -clean

2.Android Studio(版本为1.5)出现:Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.

解决方式:尝试使用VPN解决无果,在gradle/wrapper/gradle-wrapper.properties文件中有:distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip,观察Android Studio gradle sync的时候每次都是在尝试下载gradle的时候出现上述问题,所以干脆直接单独下载gradle-2.4-all.zip文件(http://services.gradle.org/distributions),并把zip文件放到C:\Users\用户名.gradle\wrapper\dists\gradle-2.4-all\6r4uqcc6ovnq6ac6s0txzcpc0文件夹中,重新gradle sync即可解决问题。