Android Studio 错误Error:(16, 13) Failed to resolve: com.android.support:support-v4:15.+ android.vi

错误1:
Error:(16, 13) Failed to resolve: com.android.support:support-v4:15.+
<a href="install.m2.repo">Install Repository and sync project</a><br><a href="openFile:D:/UserData/scxh/Desktop/call/call/build.gradle">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>


解决办法:
方法一:
打开build.gradle文件,看dependencies{   }里面是不是有compile 'com.android.support:support-v4:15.+'和compile files('libs/android-support-v4.jar')两个,如果有就删除没找到的那个,比如上面的例子就该删除compile 'com.android.support:support-v4:15.+'
方法二:在android sdk manager上把 android library support的库也都装上,重新build。


错误2:
android.view.InflateException: Binary XML file line #7: Error inflating class fragment
关键log:
Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
Caused by: java.lang.IllegalArgumentException: Binary XML file line #7: Must specify unique android:id, android:tag, or have a parent with an id for fragment_demo.fragment.FragmentTwo

解决办法:看报错类对应布局里的Fragment 是否定义了id属性。把id属性加上。XML布局文件中Fragment标签必须设置id属性。




注意事项:
Android SDK 6.0的Fragment回调方法中的android.view.InflateException:参数为Content很有可能不会执行的哟。其他都没错的话就看看这个方法执行没有吧。
    @Override
    public void onAttach(Content content) {
        super.onAttach(content);
        Log.d("test", "onAttach:00000000000000000000000 ");
        Mylog.d("onAttach-------------------------");
    }


若没执行还是用SDK6.0之前用的onAttach(Activity activity)参数为Activity回调方法吧。
 @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        Log.d("test", "onAttach:00000000000000000000000 ");
        Mylog.d("onAttach-------------------------");
    }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值