I have installed my apk bundle that I created via Build APK(s) and it installs but won't let me open it, and it doesn't show in the menu.
I've already checked Project/App/src/main/AndroidManifest.xml and Project/build.gradle and settings.gradle as well but I don't find anything odd.
android:protectionLevel="signature" is not in any of the previous files.
minifyEnabled is FALSE
I've read somewhere to edit my manifest and add or something (I can't find the post right now). I did it, and the app began to have gradle errors, and showed me another manifest that had those lines written.
Here's my Project/App/src/main/AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.multicobertura">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.Multicobertura" />
</manifest>
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
settings.gradle
include ':app'
rootProject.name = "multicobertura"
I am clueless
EDIT: I tried adding "entry points"
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.multicobertura">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.Multicobertura" />
<activity
android:name=".NewEntryPoint"
android:label="#string/title_activity_second" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</manifest>
But
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app build.gradle
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.example.multicobertura"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
EDIT2: I've already created a new android studio project, copied the files and yarn insalled the modules, built the app and failed as well. Anyone?
Related
I'm a new Kotlin Programmer. I tried to change the app icon by deleting the ic_launcher.png files and replacing my own images. As i see that is ridiculous what i'm trying to do, i copied the "Main Activity.kt" and "main_activity.xml" files and created a new project. As i tried to copy the files into the new project, the program throws a lot of errors:
It didn't imported the "kotlinx" packet and didn't perceive the elements in the xml file. As i tried to create an another new project to try whether the problem is only for this project, i realized that Android Studio doesn't perceive the xml elements anymore.
Here are some important infos about my project:
The Android Manifest XML File
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ihdovanay.myapplication">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.MyApplication">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
The Build Gradle File of The Project
buildscript {
ext.kotlin_version = "1.4.10"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The Build Gradle File of the Module
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.ihdovanay.myapplication"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
I would be very happy if you could solve my problem.
Revised answer after the deprecation of view synthetics.
You're missing the kotlin-android-extensions plugin in your build.gradle. It's responsible for generating synthetic view references.
kotlin-android-extensions is now deprecated, so it is no longer included by default and should no longer be added to projects. You should use findViewById or View Binding.
You can make it work by doing the following, but I don't recommend adding and relying on a deprecated library. Add the line to your plugins block at the top:
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
}
In Android Studio 4.1.1, the following code is missing in build.gradle (module: yourAppName)
id 'kotlin-android-extensions'
There is a very simple app made by Kotlin, it can work well under Android 8.0, Android 6.0 and Android 5.1 in Android Studio 3.0
but I get the error message "java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{info.dodata.mirror/ui.UIMain}: java.lang.ClassNotFoundException: ui.UIMain" when I run the app under Android 4.1. 2 (This is a real mobile phone) and Android 4.2.2
You can test it by download the app at https://www.dropbox.com/s/9f0yxp5pqqxtcxq/Mirror.zip?dl=0
UIMain.kt
package ui
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import info.dodata.mirror.R
class UIMain : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.layout_main)
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="info.dodata.mirror">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name="ui.UIMain">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
build.gradle (Module:app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
flavorDimensions "default"
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
applicationId "info.dodata.mirror"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.01"
archivesBaseName = "BackupSettings-V" + versionName
}
productFlavors {
free {
applicationId "info.dodata.mirror"
}
pro {
applicationId "info.dodata.mirror.pro"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "boolean", "IsDebugMode", "false"
}
debug {
buildConfigField "boolean", "IsDebugMode", "true"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:multidex:1.0.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation "org.jetbrains.anko:anko-commons:$anko_version"
implementation "org.jetbrains.anko:anko-sqlite:$anko_version"
}
build.gradle (Top)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.51'
ext.anko_version = '0.10.2'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
On Android 5.0 and later, multiple .dex files are automatically loaded by ART together. However, on earlier Android versions, Dalvik starts the application with only the main classes.dex, and the application must load the secondary the .dex files before anything else is done.
This is handled by the multidex support library, but you did not follow the instructions. This means that some of your classes are not present when the system is trying to start your activity, leading to a crash.
Depending on whether you override the Application class, perform one of the following:
If you do not override the Application class, edit your manifest file to set android:name in the <application> tag as follows:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
</manifest>
If you do override the Application class, change it to extend MultiDexApplication (if possible) as follows:
public class MyApplication extends MultiDexApplication { ... }
Or if you do override the Application class but it's not possible to change the base class, then you can instead override the attachBaseContext() method and call MultiDex.install(this) to enable multidex:
public class MyApplication extends SomeOtherApplication {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
You are currently not overriding Application, so you should follow the first case.
have a problem with android studio. Not sure what is wrong or missing from the files, here is my build.gradle file:
// 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:2.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "aaa.myplugin"
minSdkVersion 15
targetSdkVersion 24
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/classes.jar')
}
//task to delete the old jar
task cleanJar(type: Delete) {
delete 'release/MyPlugin.jar'
}
//task to export contents as jar
task exportJar(type: Copy) {
from('build/intermediates/bundles/release/')
into('release/')
include('classes.jar')
rename('classes.jar', 'MyPlugin.jar')
}
exportJar.dependsOn(cleanJar, build)
And here is my manifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="aaa.myplugin">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
</application>
</manifest>
There are several questions with the same error, but none of the solutions did work for me. Please help if you had a similar problem.
you have used wrong plugin
apply plugin: 'com.android.library'
above plugin is for library projects
applicationId is for app, it cannot be used with libraries
so add application id to the build.gradle file which has following plugin
apply plugin: 'com.android.application'
You can open Android studio,make sure that you project is open with the project model,just like the screen-capture .Now ,you can try to delete the package that has been referred to the error.
I created a project in Android studio. Even without modifying any single character in the project I cannot run it. It gives following error.
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.kk.myapplication/com.kk.myapplication.MainActivity}:
java.lang.IllegalStateException: This app has been built with an
incorrect configuration. Please configure your build for
VectorDrawableCompat.
These are the codes.
MainActivity.java :
package com.kk.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Manifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.kk.myapplication">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.kk.myapplication"
minSdkVersion 19
targetSdkVersion 24
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:24.2.0'
}
build.gradle(Top Level)
// 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.5.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
}
How can I fix this issue? I did not change anything in the project Any Help be Appreciated.
Here you will get this issue.
https://code.google.com/p/android/issues/detail?id=214182
Solution was to upgrade the gradle plugin to v2.0+ (upgraded to 2.1.0)
add this in your dependency.
{
classpath 'com.android.tools.build:gradle:2.1.0'
}
and sync the project.
Edit :
change this
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
to this
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
This is old, but another option might be for your activity to inherit from Activity instead of AppCompatActivity. There's probably a variety of other considerations that might come into play, but that worked for me.
Seems this is an issue with incompatible gradle version reported here.. Google issue
Updatating gradle version may fix this -
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
Add into your build.gradle files
defaultConfig {
applicationId "com.example.myApp"
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
generatedDensities = []
}
// This is handled for you by the 2.0+ Gradle Plugin
aaptOptions {
additionalParameters "--no-version-vectors"
}
I get this error and I have no idea how to fix it. I have java 7. Thank you in advance. I am new to codding and I dont have any past experience at all, I have done the very basic on paper programing but still. Also what do I have to do to test this application inside the android emulator? Thanks
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.>
com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 2
// 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.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lightcurb.example" >
<!-- SDK feature -->
<uses-feature
android:name="android.hardware.bluetooth_le"
android:required="true" />
<application
android:name=".LCExampleApplication"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".activity.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name"
android:noHistory="true"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.indooratlas.android.sdk.API_KEY"
android:value="c24c139a-0fd8-4072-b92d-440f1369a413"/>
<meta-data
android:name="com.indooratlas.android.sdk.API_SECRET"
android:value="jU)0v5VVdUGfpE69DUS!zLmqVhA1wiPNymesYonp6XSArIshOSfYKbhJP9v6zIpdl8U9hOhrgQiPWYYjwSWUjgjDlbi44MNu0P52dwglirV0qTAWFfY7sj)ClhXp80i1"/>
</application>
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.lightcurb.example"
minSdkVersion 18
targetSdkVersion 21
versionCode 9
versionName "1.0.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.pro'
}
}
}
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
dependencies {
compile 'com.indooratlas.android:indooratlas-android-sdk:2.0.2-beta#aar'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.radiusnetworks:AndroidIBeaconLibrary:0.7.7#aar'
compile 'com.lightcurb.sdk:LightcurbSDK:1.0.1#aar'
}
repositories{
maven {
url "http://indooratlas-ltd.bintray.com/mvn-public"
}
}