使用Android Studio直接运行应用到模拟器或手机可以运行,直接安装APK文件就报错,找不到主应用程序

计算机刘老师 2017-04-27 08:57:45
工程依赖第三方的优酷类库,直接运行没有编译错误,但是当产生签名的APK时就开始报错优酷代码的错误:在这个文件:
/*
* Copyright (c) 2015 [1076559197@qq.com | tchen0707@gmail.com]
*
* Licensed under the Apache License, Version 2.0 (the "License”);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.youku.player.ui.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.AnimationDrawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;

import com.baseproject.utils.Util;
import com.youku.player.ui.R;

public class PlayerLoading extends ImageView {

private static final int LOADING_L = -1;
// private static final int LOADING_M = 0;
private static final int LOADING_H = 1;

private static final String NAME_SPACE = "http://schemas.android.com/apk/res/android";
private static final String TAG = "tag";

private int mLoadingMode;
private float density = 1.5f;
private int mLoadingSize = Util.dip2px(48);
private Context context;
public PlayerLoading(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
this.density = context.getResources().getDisplayMetrics().density;
}

public PlayerLoading(Context context, AttributeSet attrs) {
super(context, attrs);
int bg = R.anim.yp_mobile_loading;

TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.PlayerNewLoading);
String loadingSize = ta.getString(R.styleable.PlayerNewLoading_playerloadingSize);
if(loadingSize == null){
setBackgroundResource(bg);
ta.recycle();
return;
}
if(loadingSize.equals("large")){
mLoadingSize = Util.dip2px(76);
}else if(loadingSize.equals("small")){
mLoadingSize = Util.dip2px(16);
}
ta.recycle();
setBackgroundResource(bg);
}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(mLoadingSize, mLoadingSize);
}

public void startAnimation() {
this.post(new Runnable() {

@Override
public void run() {
AnimationDrawable animationDrawable = (AnimationDrawable) PlayerLoading.this
.getBackground();
animationDrawable.start();
}
});
}

public void stopAnimation() {
this.post(new Runnable() {

@Override
public void run() {
AnimationDrawable animationDrawable = (AnimationDrawable) PlayerLoading.this
.getBackground();
animationDrawable.stop();
}
});
}

public PlayerLoading(Context context) {
super(context);
}

@Override
protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
if (visibility == GONE || visibility == INVISIBLE) {
stopAnimation();
} else {
startAnimation();
}
}

}

报的错误时:E:\onlineMusic\remusic-master\library_youku\src\main\java\com\youku\player\ui\widget\PlayerLoading.java
Error:Error: Expected resource of type drawable [ResourceType]
...全文
788 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_36110907 2017-05-05
  • 打赏
  • 举报
回复
错误是少资源文件。。。
毛豆啊 2017-04-28
  • 打赏
  • 举报
回复
看下这篇博客里的方法能不能解决你的问题:http://blog.csdn.net/zhufuing/article/details/50901133

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧