1、import android.support.v4.app.FragmentActivity;问题
参考这个,我添加的之后的效果是这样的:
On Android Studio, File > Project Structure (Ctrl + Alt + Shift + S) Select app, tab Dependecies, and in the +, put the libraries that you will use:
2、在上面添加模块之后出现了这个错误:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_20\bin\java.exe'' finished with non-zero exit value 2。
Probably you dont add suport-v4 library correctly in your project.Check this :1)you have add this library to all modules that need it (If you have more than module in your project like main module and library module).2)Check that you dont add this library twice.Finally if this didn't resolve your problem try to remove this library from your imported libraries list and your project modules dependency list and import and add it again from one source to your project , then try rebuild the project or restart the IDE.
我是因为重复添加了这个jar包:android-support-v4.jar。当时已经知道我的问题应该是没有添加这个jar包,所以直接添加在项目的libs文件夹中,但是不知道为什么还是出现了一些问题,所以我按照上面的步骤添加了这个library dependency。于是,重复了。