在这篇文章中,我们将带领您了解Android:在Manifest中找不到活动,但它在那里?的全貌,包括androidmanifest在哪的相关情况。同时,我们还将为您介绍有关AdView–Androi
在这篇文章中,我们将带领您了解Android:在Manifest中找不到活动,但它在那里?的全貌,包括androidmanifest在哪的相关情况。同时,我们还将为您介绍有关AdView – AndroidManifest.xml中的android:configChanges缺少adActivity、android manifest.xml 反编译,AndroidManifest.xml反编译及重新编译简单教程、Android Manifest错误活动无法分配给android.app.activity、Android Studio导入第三方库,找不到AndroidManifest.xml的知识,以帮助您更好地理解这个主题。
本文目录一览:- Android:在Manifest中找不到活动,但它在那里?(androidmanifest在哪)
- AdView – AndroidManifest.xml中的android:configChanges缺少adActivity
- android manifest.xml 反编译,AndroidManifest.xml反编译及重新编译简单教程
- Android Manifest错误活动无法分配给android.app.activity
- Android Studio导入第三方库,找不到AndroidManifest.xml
Android:在Manifest中找不到活动,但它在那里?(androidmanifest在哪)
我无法弄清楚为什么!我检查了logcat,我看到它崩溃的原因是因为它没有在清单文件中找到Activity,原因不明.
我看过类似的线程,但没有一个答案似乎适合我.
这是我开始活动的代码:
public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
Intent ntnt = new Intent(MainActivity.this, SettingsActivity.class);
startActivity(ntnt);
}
}
和清单文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="se.jbhalmstad.ndroid"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SettingsActivity"></activity>
</application>
</manifest>
正如你所看到的,我在标签内部的Manifest底部声明了我正在尝试启动的SettingsActivity.
我可能会失明,但我找不到任何错误.你能?
如果您需要更多源代码,请告诉我,但是SettingsActivity应该是无关紧要的,因为在运行程序时它不会获得该var.
源代码
如果你想仔细看看,这里是完整的源代码.
http://www.speedyshare.com/files/30343046/project.zip
解决方法:
问题出在您的SettingsActivity中
当您使用PreferenceActivity时
addPreferencesFromresource(R.layout.settings);
设置内容.
但你正在使用
setContentView(R.layout.settings);
AdView – AndroidManifest.xml中的android:configChanges缺少adActivity
Missing adActivity with android:configChanges in AndroidManifest.xml
我找到一个修复:
Missing adActivity with android:configChanges in AndroidManifest.xml
修复说明要做以下事情:
“com.google.ads.AdActivity” is declared when using the admob sdk jar in the “libs” folder. >It seems you’re using admob via the google play services library so change:
activity android:name=”com.google.ads.AdActivity”
To
activity android:name=”com.google.android.gms.ads.AdActivity”
Also make sure you add the Meta-data tag:
我试过这个,而CatLog表示将Meta标签改回:
<Meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
我的LogCat:
02-23 14:30:27.091: E/AndroidRuntime(1278): FATAL EXCEPTION: main 02-23 14:30:27.091: E/AndroidRuntime(1278): Process: biz.midl.debtcalculator,PID: 1278 02-23 14:30:27.091: E/AndroidRuntime(1278): java.lang.RuntimeException: Unable to start activity ComponentInfo{biz.midl.debtcalculator/biz.midl.debtcalculator.MainActivity}: java.lang.IllegalStateException: The Meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4242000 but found 0. You must have the following declaration within the <application> element: <Meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> 02-23 14:30:27.091: E/AndroidRuntime(1278): at android.app.ActivityThread.performlaunchActivity(ActivityThread.java:2195) 02-23 14:30:27.091: E/AndroidRuntime(1278): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 02-23 14:30:27.091: E/AndroidRuntime(1278): at android.app.ActivityThread.access$800(ActivityThread.java:135) 02-23 14:30:27.091: E/AndroidRuntime(1278): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 02-23 14:30:27.091: E/AndroidRuntime(1278): at android.os.Handler.dispatchMessage(Handler.java:102) 02-23 14:30:27.091: E/AndroidRuntime(1278): at android.os.Looper.loop(Looper.java:136) 02-23 14:30:27.091: E/AndroidRuntime(1278): at android.app.ActivityThread.main(ActivityThread.java:5017) 02-23 14:30:27.091: E/AndroidRuntime(1278): at java.lang.reflect.Method.invokeNative(Native Method) 02-23 14:30:27.091: E/AndroidRuntime(1278): at java.lang.reflect.Method.invoke(Method.java:515) 02-23 14:30:27.091: E/AndroidRuntime(1278): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 02-23 14:30:27.091: E/AndroidRuntime(1278): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 02-23 14:30:27.091: E/AndroidRuntime(1278): at dalvik.system.NativeStart.main(Native Method) 02-23 14:30:27.091: E/AndroidRuntime(1278): Caused by: java.lang.IllegalStateException: The Meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4242000 but found 0. You must have the following declaration within the <application> element: <Meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> 02-23 14:30:27.091: E/AndroidRuntime(1278): at com.google.android.gms.common.GooglePlayServicesUtil.n(UnkNown Source) 02-23 14:30:27.091: E/AndroidRuntime(1278): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(UnkNown Source) 02-23 14:30:27.091: E/AndroidRuntime(1278): at com.google.android.gms.internal.u.a(UnkNown Source) 02-23 14:30:27.091: E/AndroidRuntime(1278): at com.google.android.gms.internal.ag.U(UnkNown Source) 02-23 14:30:27.091: E/AndroidRuntime(1278): at com.google.android.gms.internal.ag.a(UnkNown Source) 02-23 14:30:27.091: E/AndroidRuntime(1278): at com.google.android.gms.ads.AdView.loadAd(UnkNown Source) 02-23 14:30:27.091: E/AndroidRuntime(1278): at biz.midl.debtcalculator.MainActivity.onCreate(MainActivity.java:41) 02-23 14:30:27.091: E/AndroidRuntime(1278): at android.app.Activity.performCreate(Activity.java:5231) 02-23 14:30:27.091: E/AndroidRuntime(1278): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 02-23 14:30:27.091: E/AndroidRuntime(1278): at android.app.ActivityThread.performlaunchActivity(ActivityThread.java:2159) 02-23 14:30:27.091: E/AndroidRuntime(1278): ... 11 more
这是我的.java:
import java.text.DecimalFormat; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdSize; import com.google.android.gms.ads.AdView; public class MainActivity extends Activity { private AdView adView; double interestRate; double r,r1; int nRemaining,nStarting,nDifference,originalBalance,outstandingBalance,originalTerm; double minPayment,additionalPayment,newPmt; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); adView = new AdView(this); adView.setAdUnitId("xxxxxxxxxxxxxxxxxxxxxxxxxxxx"); //edited out my unitID adView.setAdSize(AdSize.BANNER); LinearLayout layout = (LinearLayout) findViewById(R.id.ll); layout.addView(adView); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest);
这是我的布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" android:id="@+id/ll" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:weightSum="1" > <com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adSize="BANNER" ads:adUnitId="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
我也有我的清单:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="biz.midl.debtcalculator" android:versionCode="1" android:versionName="1" > <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.INTERNET" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <Meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" /> <activity android:name="biz.midl.debtcalculator.MainActivity" android:label="@string/app_name" android:screenorientation="portrait" android:theme="@android:style/Theme.DeviceDefault.Light.NoActionBar.Fullscreen" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="biz.midl.debtcalculator.About" android:label="@string/app_name" android:screenorientation="portrait" android:theme="@android:style/Theme.DeviceDefault.Light.NoActionBar.Fullscreen" > <intent-filter> <action android:name="android.intent.action.ABOUT" /> </intent-filter> </activity> </application> </manifest>
解决方法
<Meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
另外,您需要替换此标签:
<activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
用这个(如你所链接的答案中所建议的):
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
由于您使用Google Play服务而不是旧版AdMob SDK,因此您需要将com.google.ads.AdActivity中的活动类名称替换为com.google.android.gms.ads.AdActivity
android manifest.xml 反编译,AndroidManifest.xml反编译及重新编译简单教程
首先得回答为什么要修改 AndroidManifest.xml 文件?如果你是通过搜索引擎进入到本页面的话,那我想你自己应该已经有答案了。其实修改 AndroidManifest.xml 可以实现很多 apk 功能上的修改。而我本人的需求就是要把 Smart Youtube TV 的版本升级提示去除掉。因为该 app 是安装在我的小米电视上的,而且该 app 更新比较频繁,每隔一段时间打开 Smart Youtube TV 就会提示版本升级,所以我想把这个“版本升级提示”去除掉。
基本思路:AndroidManifest.xml 反编译 – 修改 – 重新编译 – 打包 apk – 重新签名
那么怎么才能修改 AndroidManifest.xml 文件呢?或许你知道从 apk 直接解压出来的 xml 文件是一堆乱码来的。要正常修改 xml 文件得先进行反编译,通过反编译的 xml 文件就是正常的代码了。这时就可以修改其中的代码。例如我修改其中的 versionCode,把版本号修改成比较大的数值,这样再遇到版本升级,因为 versionCode 比修改的低所以不会提示升级。
这里重点说说 AndroidManifest.xml 反编译 & 重新编译
操作步骤:
把 apk 解压出来的 AndroidManifest.xml 文件跟 xml2axml.jar 文件放在同一个文件夹中。按 Shift 和鼠标右键进入“在此处打开 powershell 窗口”。
AndroidManifest.xml 反编译
在 powershell 窗口输入:java -jar xml2axml.jar d AndroidManifest.xml AndroidManifest-out.xml
就这么简单,反编译完成。这个时候文件夹中会出现一个 AndroidManifest-out.xml 文件,可对其进行修改。
AndroidManifest.xml 重新编译
在 powershell 窗口输入:java -jar xml2axml.jar e AndroidManifest-out.xml AndroidManifest.xml
重新编译完成。这个时候 xml2axml 文件夹中的 AndroidManifest.xml 是已经重新编译过的了。可以直接替换 apk 安装包中的 AndroidManifest.xml 进行打包与签名操作。
补充说明:利用 xml2axml.jar 进行 AndroidManifest.xml 反编译和编译是相对比较简单的方法。网上边也有很多其他的工具,例如:AXMLPrinter2.jar 和 apk Easy Tool 等工具,但都有不少缺点。 AXMLPrinter2.jar 只能反编译,不能重新编译。有何用? apk Easy Tool 重新编译整个 apk 文件经常会出现错误。我只需要修改 AndroidManifest.xml 文件,没必要用 apk Easy Tool。
以上就是 AndroidManifest.xml 文件的反编译与编译的相对简单教程。如果各位在操作的过程中遇到什么问题,欢迎在下方留言。
详细文章参考资料:http://wp.fang1688.cn/study/928.html
我叫方包,关注公众号【优派编程】,学习和了解到更多编程知识和资源干货!
感谢你的在看和 “点赞”,祝大家事业有成,学业进步,心想事成!
Android Manifest错误活动无法分配给android.app.activity
AndroidManifest中的所有屏幕显示它们不能分配给’android.app.activity’
我之前从未遇到过这个问题.显然,我的所有活动都是活动,而不是片段. (看看这里的答案,大多数都有这种错误;错误的片段为活动)
这个Android项目在过去的几个月里从未抛出过这种错误.
现在我的所有屏幕都显示红线.
不知怎的,即使有了所有这些红线,我也可以运行该项目.
这是’到目前为止我尝试过的:
>清理项目(Build – > Clean Up)
>重建项目(Build – > Rebuild)
>使缓存无效并重新启动
我正在运行最新的Android Studio.
更新:
这是我的Android Manifest:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.thispackage.thispackagename"> <uses-permission android:name="android.permission.INTERNET"/> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <Meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/> <activity android:name=".MainActivity"> </activity> <activity android:name=".SplashScreen" android:screenorientation="portrait"> </activity> <activity android:name=".ScreenOne" android:screenorientation="portrait"> </activity> <activity android:name=".ScreenTwo" android:screenorientation="portrait"> </activity> <activity android:name=".Registeractivity" android:screenorientation="portrait"> </activity> <activity android:name=".ScreenThree" android:screenorientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".ScreenFour" android:screenorientation="portrait"> </activity> <activity android:name=".ScreenFive" android:screenorientation="portrait"> </activity> <activity android:name="com.facebook.FacebookActivity" android:configChanges= "keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/app_name" /> <!--<activity android:name="com.facebook.FacebookActivity"--> <!--android:configChanges=--> <!--"keyboard|keyboardHidden|screenLayout|screenSize|orientation"--> <!--android:theme="@android:style/Theme.Translucent.NoTitleBar"--> <!--android:label="@string/app_name" />--> </application> </manifest>
更新2:以下是错误的屏幕截图.
更新3:当我点击更多时,它显示:
解决方法
>在编辑器中关闭所有打开的文件
>然后清理或重建项目
>尝试创建新项目并检查是否发生了相同的错误
>使缓存无效并重新启动android studio(文件菜单 – >使Chaches / Restart无效)
在最后,如果所有这些都没有成功,那么从项目目录和app目录中删除build文件夹.
警告 – 删除构建将删除以前生成的apk以及所有已下载和提取的依赖项
Android Studio导入第三方库,找不到AndroidManifest.xml
Android Studio 1.41版,根据网上的方法导入SlidingMenu,但是AS提示SlidingMenu找不到AndroidManifest.xml
app 下的build.gradle
apply plugin: ''com.android.application'' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.example.administrator.myapplication" minSdkVersion 14 targetSdkVersion 23 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:23.1.1'' compile ''com.android.support:design:23.1.1'' compile project ('':SlidingMenu-master'') }
SlidingMenu-master下的build.gradle
buildscript { repositories { mavenCentral() } dependencies { classpath ''com.android.tools.build:gradle:1.3.0'' } } apply plugin: ''com.android.library'' repositories { mavenCentral() } android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 14 targetSdkVersion 23 } sourceSets { main { manifest.srcFile ''AndroidManifest.xml'' java.srcDirs = [''src''] resources.srcDirs = [''src''] aidl.srcDirs = [''src''] renderscript.srcDirs = [''src''] } } } dependencies { compile ''com.android.support:appcompat-v7:'' compile files(''libs/gson-2.2.4.jar'') }MyApplication下的 build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath ''com.android.tools.build:gradle:1.3.0'' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir }settings.gradle
include '':app'','':SlidingMenu-master''Studio报错
slidingmenu直接从github下载的,解压以后直接把整个文件夹copy到app同目录下
解压出来就没有AndroidManifest.xml文件,希望大神们帮忙解答一下,万分感谢!
我们今天的关于Android:在Manifest中找不到活动,但它在那里?和androidmanifest在哪的分享已经告一段落,感谢您的关注,如果您想了解更多关于AdView – AndroidManifest.xml中的android:configChanges缺少adActivity、android manifest.xml 反编译,AndroidManifest.xml反编译及重新编译简单教程、Android Manifest错误活动无法分配给android.app.activity、Android Studio导入第三方库,找不到AndroidManifest.xml的相关信息,请在本站查询。
本文标签: